-
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
Elle #13
base: master
Are you sure you want to change the base?
Elle #13
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.
Really good work here! You did a great job especially with the circular buffer in the Queue. Let me know if you have any questions with my comments.
@@ -1,9 +1,68 @@ | |||
require_relative './stack.rb' | |||
|
|||
def balanced(string) | |||
raise NotImplementedError, "Not implemented yet" | |||
|
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!
else | ||
@store[@rear] = element | ||
@rear = (@rear + 1) % QUEUE_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.
Great work here!
lib/queue.rb
Outdated
i = @front + 1 | ||
until i == @rear | ||
array_as_string = array_as_string + ", #{@store[i]}" | ||
i += 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.
Since the array could wrap around, you should do i = (i + 1) % QUEUE_SIZE
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation