-
Notifications
You must be signed in to change notification settings - Fork 44
Time - Sharon #17
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
base: master
Are you sure you want to change the base?
Time - Sharon #17
Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done Sharon, you hit all the learning goals here. Take a look at my comments and let me know what questions you have.
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def balanced(string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Instead of using the case statements, you could instead use a hash where the keys are the close braces and the values are the matching open braces.
| @size = 20 | ||
| end | ||
|
|
||
| def enqueue(element) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
You can make @rear go to the next index with @rear = (@rear + 1) % size
| end | ||
| end | ||
|
|
||
| def dequeue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can adjust @front the same way rear can change (See above).
| return @store[@front] | ||
| end | ||
|
|
||
| def size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| @@ -1,19 +1,22 @@ | |||
| class Stack | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation