-
Notifications
You must be signed in to change notification settings - Fork 49
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
Julia Kingrey #28
base: master
Are you sure you want to change the base?
Julia Kingrey #28
Conversation
…r fixed-length array.
…what was happening and updated enqueue code so that resizing works as expected.
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.
Problem s with some of your minor Queue methods, but you do have enqueue and dequeue working right. Nice work.
if hash['('] == hash[')'] && hash['{'] == hash['}'] && hash['['] == hash[']'] | ||
return true | ||
else | ||
return false | ||
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.
This doesn't quite work as it only counts the number of the characters, not if they're matched.
@back = -1 | ||
|
||
# default status is empty | ||
@is_empty = true | ||
end | ||
|
||
def enqueue(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.
👍
if @is_empty | ||
@is_empty = false | ||
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.
👍
end | ||
|
||
def front | ||
raise NotImplementedError, "Not yet implemented" | ||
@front |
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.
@front | |
return @store[@front] |
end | ||
|
||
def size | ||
raise NotImplementedError, "Not yet implemented" | ||
return @store.length |
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 gets you the size of the internal array, not the amount of elements stored in the queue.
end | ||
|
||
def empty? | ||
raise NotImplementedError, "Not yet implemented" | ||
return @is_empty | ||
end | ||
|
||
def 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.
Needs to be updated.
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation