-
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
Heather #14
base: master
Are you sure you want to change the base?
Heather #14
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.
Overall pretty good work. Take a look at my comments on the Queue, but otherwise outstanding work.
raise NotImplementedError, "Not implemented yet" | ||
return true if string == "" | ||
|
||
parens_hash = { |
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.
Good use of a hash!
elsif @front == (@rear + 1) % @store.length # queue is full | ||
raise Error, "Q full" | ||
else # queue not empty | ||
@rear += 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.
This needs to be @rear = (@rear + 1) % QUEUE_SIZE
because the rear could wrap around the array.
raise NotImplementedError, "Not yet implemented" | ||
if @front == -1 # queue is empty | ||
@front = 0 | ||
@rear = 0 |
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.
Starting front and rear at the same number could cause problems if someone tries to dequeue a few times.
end | ||
|
||
def to_s | ||
return @store.to_s | ||
return @store[@front..@rear].to_s |
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