Data structures and algorithms walkthrough in Python
Linked List Review
I have implemented a linked list in Python! by:
- Defining a Node class to hold the values and links between nodes
- Implementing a LinkedList class to handle external operations on the list like adding and removing nodes
Queues Python Review
I have implemented a queue data structure in Python by creating a Queue class that:
- follows FIFO protocol with enqueue(), dequeue(), and peek() methods
- gives you the option of creating bounded queues with a max_size
- prevents queue “overflow” and “underflow” by keeping track of size
Stacks Python Review
I have built out a Stack class that can:
- add a new item to the top via a push() method
- remove an item from the top and returns its value with a pop() method
- return the value of the top item using a peek() method
- allows a stack instance to maintain an awareness of its size to prevent stack “overflow”