You will find the implementation of different data structures and algorithms using Python.
- Fork the repository
- Do the desired changes (add/delete/modify)
- Make a pull request
Constructive criticisms or code reviews of any kind are very much welcome.
If you have any questions about the solutions you can find here, feel free to contact me at: [email protected]
- Python interpreter
In python, it is possible to implement a stack using
- list
- deque
- LifoQueue
For our implementation, we have decided to implement a stack using a list
Queue in Python can be implemented by the following ways:
-
list
-
collections.deque
-
queue.Queue
-
Enqueue: Adds an item to the queue. If the queue is full, then it is said to be an Overflow condition – Time Complexity : O(1)
-
Dequeue: Removes an item from the queue. The items are popped in the same order in which they are * pushed. If the queue is empty, then it is said to be an Underflow condition – Time Complexity : O(1)
-
Front: Get the front item from queue – Time Complexity : O(1) *Rear: Get the last item from queue – Time Complexity : O(1)