-
Notifications
You must be signed in to change notification settings - Fork 6
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
Water - Christabel #2
base: master
Are you sure you want to change the base?
Conversation
This reverts commit bc364ed.
…k helper to peek at last added 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.
Nice work Christabel, you hit the learning goals here. Well done!
Time Complexity: O(n) | ||
Space Complexity: O(n) | ||
*/ | ||
const balanced = (str) => { |
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) | ||
Space Complexity: O(n) | ||
*/ | ||
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.
👍
} | ||
|
||
enqueue(element) { | ||
throw new Error("This method has not been implemented!"); | ||
enqueue(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.
👍
} else { | ||
this.rear++; | ||
} | ||
this.store[this.rear] = value; | ||
} | ||
|
||
dequeue() { |
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.
👍
const dequeued = this.store[this.front]; | ||
this.store[this.front] = null; | ||
|
||
return dequeued; | ||
} | ||
|
||
front() { |
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.
👍
} | ||
|
||
front() { | ||
throw new Error("This method has not been implemented!"); | ||
return this.store[front]; | ||
} | ||
|
||
size() { |
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.
🤔 I'm not sure this this will work in all cases.
if (this.front == this.rear) { | ||
return true; | ||
} else { | ||
return false; | ||
} |
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.
Maybe just do this
if (this.front == this.rear) { | |
return true; | |
} else { | |
return false; | |
} | |
return this.front == this.rear; |
@@ -1,19 +1,31 @@ | |||
const LinkedList = require("./linked-list"); | |||
|
|||
class Stack { |
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.