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

Cedar-Bailey #7

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

Cedar-Bailey #7

wants to merge 11 commits into from

Conversation

beaniebaye
Copy link

No description provided.

Copy link

@kyra-patton kyra-patton 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, Bailey. Looks like you have a solid understanding of queues and stacks. Let me know what questions you have.

🟢

Time Complexity: O(n) single loop
Space Complexity: O(n) single stack used
*/
const balanced = (string) => {

Choose a reason for hiding this comment

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

Time Complexity: O(n) single loop
Space Complexity: O(n) single stack
*/
const evaluatePostfix = (expr) => {

Choose a reason for hiding this comment

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

if (this.length >= this.capacity) return;

this.tail = (this.tail + 1) % this.capacity;
this.store[this.tail % this.capacity] = element;

Choose a reason for hiding this comment

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

Suggested change
this.store[this.tail % this.capacity] = element;
this.store[this.tail] = element;

}

enqueue(element) {
throw new Error("This method has not been implemented!");
if (this.length >= this.capacity) return;

Choose a reason for hiding this comment

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

}

dequeue() {
throw new Error("This method has not been implemented!");
if (this.isEmpty()) return;

Choose a reason for hiding this comment

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

class Stack {
constructor() {
// this.store = ...
throw new Error("This method has not been implemented!");
this.store = new LinkedList();

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

Choose a reason for hiding this comment

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

}

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

Choose a reason for hiding this comment

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

}

isEmpty() {
throw new Error("This method has not been implemented!");
return this.store.isEmpty();

Choose a reason for hiding this comment

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

}

toString() {
JSON.stringify(this.store);
this.store.toString();

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