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

stacks & queues; queue with circular buffer implementation #58

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

Conversation

ropeeps
Copy link

@ropeeps ropeeps commented Sep 28, 2022

Stacks and Queues

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

Comprehension Questions

Question Answer
What is an ADT? ADT stands for abstract data type. ADTs specify a specific structure with built-in methods, without restricting which underlying data structure can be used. For instance, an ADT can be applied with a linked_list, array, etc.
Describe a Stack A stack is an ADT that adds and removes elements in a LIFO pattern. The last element added to a stack is the first element removed.
What are the 5 methods in Stack and what does each do? push() to add an element to the top of the stack; pop() to remove and return the element at the top of the stack; is_empty() to return True is the stack is empty; peek() is like push(), except peek() will return the element at the top of the stack without removing it; size() to return the number of elements in the stack
Describe a Queue A queue is an ADT that adds and removes elements in a FIFO pattern. The first element added is the first element removed, like an assembly line.
What are the 5 methods in Queue and what does each do? enqueue(element) to add an element to the rear of the queue; dequeue() to remove and return the element at the front of the queue; is_empty to return True if the queue is empty; front() to return the element at the front of the queue without removing it; is_full to return True if the queue is full
What is the difference between implementing something and using something? "Implementing" means including an ADT and the methods that go along with it in your code. The description of the underlying data structure is hidden from the user partly for security reasons and partly because the user doesn't need to know this information in order to interact with your code. "Using" refers to the data structure you chose to internally store the data in your stack, queue, or other ADT.

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