-
Notifications
You must be signed in to change notification settings - Fork 42
Shubha 🌵 #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?
Shubha 🌵 #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.
Thanks for getting this in. Well done! You hit all the learning goals here.
| @@ -1,9 +1,41 @@ | |||
| require_relative './stack.rb' | |||
|
|
|||
| 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.
👍
| stack.empty? ? (return true) : (return false) | ||
| end | ||
|
|
||
| def evaluate_postfix(postfix_expression) |
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.
👍
| if (@head == @tail && !empty?) | ||
| return @capacity | ||
| elsif @head == @tail | ||
| return 0 | ||
| elsif @tail > @head | ||
| return @tail - @head | ||
| elsif @tail < @head | ||
| return @capacity - (@head - @tail) | ||
| 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.
Nice! 🥇
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
push: add to stack,pop: remove from stack,peek: return top of stack without removing it,size: number of items in stack,empty: whether stack is emptyenqueue: add to queue,dequeue: remove from queue,front: return front of queue without removing it,size: number of items in queue,empty: whether queue is emptyOPTIONAL JobSimulation