-
Notifications
You must be signed in to change notification settings - Fork 42
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
Faiza #22
base: master
Are you sure you want to change the base?
Faiza #22
Conversation
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.
Some issues here with the circular buffer, but overall this is pretty good. Take a look at my comments and let me know where you have questions.
"{" => "}", | ||
} | ||
|
||
stack = Stack.new |
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.
Nicely done
if @front == -1 # Q is empty | ||
return | ||
|
||
elsif @front == @rear # There's only 1 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.
When front and rear are equal, the Queue is not empty, it's full.
When they're equal after removing an element, then the queue is empty.
array = [] | ||
@store.each_with_index do |element, i| | ||
next if i < @front | ||
break if element.nil? |
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.
What if you've removed 1 element from the front of the queue. Then @store[0]
will be nil, and you'll exit the loop early here.
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation