-
Notifications
You must be signed in to change notification settings - Fork 41
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
completing all req exercises #24
base: master
Are you sure you want to change the base?
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.
Nice work Iris, you hit the learning goals here. Your queue methods are pretty slick and very compact. Well done.
@size += 1 | ||
if (@front == -1) | ||
@front, @back = 0, 0 | ||
elsif(@back == (@store.length - 1) && @front != 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.
I don't think you need to check @front != 0
here because you did that on line 11.
else | ||
@back += 1 | ||
end | ||
@store[@back] = element | ||
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.
👍 , nicely done
end | ||
|
||
def front | ||
raise NotImplementedError, "Not yet implemented" | ||
return @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.
This should really return the number of items in the queue, not the size of the internal store.
@@ -1,19 +1,18 @@ | |||
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