Skip to content

Aimee 👾 - Fire 🔥#4

Open
marks214 wants to merge 5 commits into
Ada-C13:masterfrom
marks214:master
Open

Aimee 👾 - Fire 🔥#4
marks214 wants to merge 5 commits into
Ada-C13:masterfrom
marks214:master

Conversation

@marks214
Copy link
Copy Markdown

@marks214 marks214 commented Apr 5, 2021

No description provided.

Copy link
Copy Markdown

@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 Aimee, you hit the essential classes. Nice work.

Comment thread lib/problems.js
Comment on lines +3 to 6
Time Complexity: O(n^2) - the stack.pop() method invoked has O(n) time complexity and it is used inside a for loop.
Space Complexity: O(n) - we keep pushing values to the stack for a string of length n.
*/
const balanced = (str) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 I'm pretty sure the pop method has O(1) time complexity leading your solution to O(n) time complexity overall.

Comment thread lib/queue.js

enqueue(element) {
throw new Error("This method has not been implemented!");
enqueue(value) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/queue.js
this.tail = (this.tail + 1) % Queue.maxLenth;
}

dequeue() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You should also check to see if the head and tail are equal, if so the Queue is empty and you should do something to avoid removing null entries.

Comment thread lib/stack.js

push() {
throw new Error("This method has not been implemented!");
push(value) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/stack.js
this.store.addLast(value);
}

pop() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/stack.js
return lastValue;
}

isEmpty() {
Copy link
Copy Markdown

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