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

Aimee 👾 - Fire 🔥 #4

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

Aimee 👾 - Fire 🔥 #4

wants to merge 5 commits into from

Conversation

marks214
Copy link

@marks214 marks214 commented Apr 5, 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.

Well done Aimee, you hit the essential classes. Nice work.

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

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.

}

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.

👍

throw new Error("Queue is Full!")
}
this.store[len] = value;
this.tail = (this.tail + 1) % Queue.maxLenth;
}

dequeue() {

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.

}

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

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) {
this.store.addLast(value);
}

pop() {

Choose a reason for hiding this comment

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

👍

throw new Error("This method has not been implemented!");
const lastValue = this.store.getLast()
this.store.delete(lastValue);
return lastValue;
}

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