Skip to content

Conversation

@seattlefurby17
Copy link

Stacks and Queues

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

Comprehension Questions

Question Answer
What is an ADT? An Abstract Data Type, is a type of object which is described by the methods it has and how they perform. Implementation details are not included.
Describe a Stack A Stack is a data structure which stores a list of data and only provides access in a Last-In-First-Out (LIFO) order.
What are the 5 methods in Stack and what does each do? push(item) - This method puts an item into the stack at the top.
pop - This method removes and returns the item on the top of the stack.
is_empty - This method returns true if the stack is empty and false otherwise.
A Stack might also implement a peek method which returns, but does not remove the item on top of the stack, and size which would return the number of items on the stack.
Describe a Queue A queue unlike a stack operates in a first-in-first out order. Like a line of people at a concert, the first element to enter the queue is the first element removed.
What are the 5 methods in Queue and what does each do? enqueue(item) - This method puts an item into the back of the queue.
dequeue - This method removes and returns the item at the front of the queue.
is_empty - This method returns true if the queue is empty and false otherwise.
What is the difference between implementing something and using something?

OPTIONAL JobSimulation

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

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.

1 participant