Skip to content
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

Angele Z. #41

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Angele Z. #41

wants to merge 5 commits into from

Conversation

geli-gel
Copy link

@geli-gel geli-gel commented Mar 3, 2020

Stacks and Queues

Thanks for doing some brain yoga. You are now submitting this assignment!

Comprehension Questions

Question Answer
What is an ADT? Abstract Data Type
Describe a Stack An ADT of a list type of data structure with a first-in, last-out working.
What are the 5 methods in Stack and what does each do? Stack has initialize (to create a linked list), push (to add to the end of the list), pop (to remove from the end of the list), empty? (to check if the list is empty), and to_s (to traverse and print the info from the linked list)
Describe a Queue An ADT of a list type of data structure with a first-in, first-out working.
What are the 5 methods in Queue and what does each do? initialize (to create an array of a fixed size), enqueue (to add to the array), dequeue( to remove from the array), front (to show what is at the front (next to be dequeued) of the array, and size (to return the length of the queue that isn't empty - from the front pointer to the back pointer)
What is the difference between implementing something and using something? Implementing something means using basic structures to make it work a certain way (like using arrays to form a system of a first in, last out sort of queue) and using is just calling the methods that have already been implemented.

OPTIONAL JobSimulation

Question Answer
Did you include a sample run of your code as a comment?

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well you have most of the Stack class working, with one error, otherwise nice work. If you add any methods to Queue and want me to look over it, ping me in Slack and I'll give additional feedback.

I would have liked to see at least dequeue attempted.

@@ -26,6 +40,13 @@ def empty?
end

def to_s

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

lib/stack.rb Outdated
end

def empty?
raise NotImplementedError, "Not yet implemented"
return @store ? true : false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be:

Suggested change
return @store ? true : false
return @store.empty?

Because @store is an instance of LinkedList and won't be nil.

@@ -1,12 +1,26 @@
class Queue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting dequeue and size are not implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants