-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cedar-Bailey #7
base: master
Are you sure you want to change the base?
Cedar-Bailey #7
Conversation
… passes 6/16 tests
…nd implements Queue class
… these attributes in my constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨😎 Nice work, Bailey. Looks like you have a solid understanding of queues and stacks. Let me know what questions you have.
🟢
Time Complexity: O(n) single loop | ||
Space Complexity: O(n) single stack used | ||
*/ | ||
const balanced = (string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
Time Complexity: O(n) single loop | ||
Space Complexity: O(n) single stack | ||
*/ | ||
const evaluatePostfix = (expr) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
if (this.length >= this.capacity) return; | ||
|
||
this.tail = (this.tail + 1) % this.capacity; | ||
this.store[this.tail % this.capacity] = element; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.store[this.tail % this.capacity] = element; | |
this.store[this.tail] = element; |
} | ||
|
||
enqueue(element) { | ||
throw new Error("This method has not been implemented!"); | ||
if (this.length >= this.capacity) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
} | ||
|
||
dequeue() { | ||
throw new Error("This method has not been implemented!"); | ||
if (this.isEmpty()) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
class Stack { | ||
constructor() { | ||
// this.store = ... | ||
throw new Error("This method has not been implemented!"); | ||
this.store = new LinkedList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
} | ||
|
||
push() { | ||
throw new Error("This method has not been implemented!"); | ||
push(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
} | ||
|
||
pop() { | ||
throw new Error("This method has not been implemented!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
} | ||
|
||
isEmpty() { | ||
throw new Error("This method has not been implemented!"); | ||
return this.store.isEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
} | ||
|
||
toString() { | ||
JSON.stringify(this.store); | ||
this.store.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
No description provided.