Skip to content

Ringo - Earth#3

Open
ringolingo wants to merge 3 commits intoAda-C14:masterfrom
ringolingo:master
Open

Ringo - Earth#3
ringolingo wants to merge 3 commits intoAda-C14:masterfrom
ringolingo:master

Conversation

@ringolingo
Copy link

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.

Well done Ringo, you hit the learning goals. I had one comment on dequeue, but otherwise this works well.

Comment on lines +3 to 8
Time Complexity: O(n), the function has to visit every node once
but operations performed in that loop are O(1)
Space Complexity: O(n), worst case scenario the stack could have on it
every character in the string
*/
const balanced = (str) => {

Choose a reason for hiding this comment

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

👍

Comment on lines +27 to 34
Time Complexity: O(n), the function has to check every character in expr,
but operations in the for loop are O(1)
Space Complexity: O(n), the controlling factor is the height of the stack,
which does not grow quickly with longer expr in a normal use case but I suppose
in a worst case scenario with some weird postfix expressions would increase in size
linear to the length of the weird expression you were using
*/
const evaluatePostfix = (expr) => {

Choose a reason for hiding this comment

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

👍

}
}

dequeue() {

Choose a reason for hiding this comment

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

👍 Very compact! However what happens if you dequeue an empty queue?

this.tail = 0;
}

enqueue(element) {

Choose a reason for hiding this comment

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

👍 Nice work, very compact

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