Skip to content
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

🌊 - Richelle #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

🌊 - Richelle #4

wants to merge 6 commits into from

Conversation

r-spiel
Copy link

@r-spiel r-spiel commented Apr 17, 2021

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Richelle, you hit the learning goals, well done. Very clean code and well done.

Comment on lines +4 to 7
Time Complexity: O(n) worst case if all are opening brackets
Space Complexity: same as above
*/
const balanced = (str) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I love the use of the JS Object here as a hash.

Comment on lines +28 to 31
Time Complexity: O(n)
Space Complexity: O(n)
*/
const evaluatePostfix = (expr) => {

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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

this.store[this.tail] = value;
this.tail = (this.tail + 1) % this.maxSize;
}

}

dequeue() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// reset head and tail to -1
if (this.head === this.tail) this.head = this.tail = -1;

return data;
}

front() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 , you might also want to check to see if the queue is empty here.

}

front() {
throw new Error("This method has not been implemented!");
return this.store[this.head];
}

size() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

visited ++;
}

return count;
}

isEmpty() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants