- Compare abstract data types and concrete data structures
- Abstract data types: list, stack, queue, deque (double-ended queue)
- Concrete data structures: array, dynamic array (resizable array, vector), linked list
- Review Make School's stack and queue slides
- Watch Make School's stack and queue video lecture
- Watch HackerRank's stack and queue video
- Watch Harvard's stack video and queue video
- Play with VisuAlgo's interactive stack and queue visualization
- Implement
LinkedStackclass (stack with linked list) andArrayStackclass (stack with dynamic array) using stack starter code:- Implement
is_empty- check if the stack is empty - Implement
length- return the number of items in the stack - Implement
push(item)- insertitemon the top of the stack - Implement
peek- return the item on the top of the stack - Implement
pop- remove and return the item on the top of the stack - Run
pytest stack_test.pyto run the stack unit tests and fix any failures
- Implement
- Annotate
pushandpopmethods with running time complexity analysis - Implement
LinkedQueueclass (queue with linked list) andArrayQueueclass (queue with dynamic array) using queue starter code:- Implement
is_empty- check if the queue is empty - Implement
length- return the number of items in the queue - Implement
enqueue(item)- insertitemat the back of the queue - Implement
front- return the item at the front of the queue - Implement
dequeue- remove and return the item at the front of the queue - Run
pytest queue_test.pyto run the queue unit tests and fix any failures
- Implement
- Annotate
enqueueanddequeuemethods with running time complexity analysis
- Implement
Dequeclass (double-ended queue) with doubly linked list or dynamic array (your choice):- Implement
is_empty- check if the deque is empty - Implement
length- return the number of items in the deque - Implement
push_front(item)- insertitemat the front of the deque - Implement
push_back(item)- insertitemat the back of the deque - Implement
front- return the item at the front of the deque - Implement
back- return the item at the back of the deque - Implement
pop_front- remove and return the item at the front of the deque - Implement
pop_back- remove and return the item at the back of the deque
- Implement
- Write unit tests for to ensure the
Dequeclass is robust- Include test cases for each class instance method
- Annotate
push_front,push_back,pop_front, andpop_backmethods with running time complexity analysis