-
Notifications
You must be signed in to change notification settings - Fork 44
Time - Denisse #28
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 - Denisse #28
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.
Overall nice work Denisse, you hit the main learning goals here. 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.
👍 Thanks for documenting your source!
|
|
||
| def enqueue(element) | ||
| raise NotImplementedError, "Not yet implemented" | ||
| if ((@front == 0 && @back == @size - 1) || (@back == (( @front - 1) % ( @size - 1)))) |
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.
I think this looks a little simpler
| if ((@front == 0 && @back == @size - 1) || (@back == (( @front - 1) % ( @size - 1)))) | |
| if ((@front == 0 && @back == @size - 1) || (@front == (( @back + 1) % ( @size)))) |
| elsif (@front == @size - 1 ) | ||
| @front = 0 | ||
| else | ||
| @front += 1 | ||
| end |
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.
| elsif (@front == @size - 1 ) | |
| @front = 0 | |
| else | |
| @front += 1 | |
| end | |
| else | |
| @front = (@front + 1) % @size | |
| end |
| 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.
👍
| # end | ||
| end | ||
|
|
||
| def empty? |
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,23 @@ | |||
| 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