Skip to content

Conversation

@anyatokar
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? Abstract Data Type, an object described by its methods and how they perform (as opposed to its implementation details).
Describe a Stack A data structure that stores data and provides Last-In-First-Out access.
What are the 5 methods in Stack and what does each do? push(item) - adds item to the top of the stack. pop - removes from the top and returns this item. is_empty - boolean whether the list is empty (true if yes). peek - returns item at the top of the stack. size - returns the number of items on the stack.
Describe a Queue A data structure that stores data and provides First-In-First-Out access.
What are the 5 methods in Queue and what does each do? enqueue(item) - puts item on back of the queue. dequeue - removes item at the front of the queue and returns it. is_empty - boolean whether the queue is empty (true if yes). peek - returns item at the front of the queue. size - returns number of items in queue.
What is the difference between implementing something and using something? Implementing something reveals details about how it's implemented, such as data type used. Using something does not reveal implementation details, just how it performs. For example you can use a stack and implement it with an array or list.

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