- 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
- Read Vaidehi Joshi's articles on stacks and queues with beautiful drawings and excellent examples
- 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
LinkedStack
class (stack with linked list) andArrayStack
class (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)
- insertitem
on 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.py
to run the stack unit tests and fix any failures
- Implement
- Annotate
push
andpop
methods with running time complexity analysis - Implement
LinkedQueue
class (queue with linked list) andArrayQueue
class (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)
- insertitem
at 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.py
to run the queue unit tests and fix any failures
- Implement
- Annotate
enqueue
anddequeue
methods with running time complexity analysis
- Implement
Deque
class (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)
- insertitem
at the front of the deque - Implement
push_back(item)
- insertitem
at 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
Deque
class is robust- Include test cases for each class instance method
- Annotate
push_front
,push_back
,pop_front
, andpop_back
methods with running time complexity analysis