Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.58 KB

File metadata and controls

47 lines (31 loc) · 1.58 KB

Algorithm And Data-structures

What you can find in this folder

You will find the implementation of different data structures and algorithms using Python.

How to contribute

  1. Fork the repository
  2. Do the desired changes (add/delete/modify)
  3. Make a pull request

Mind that

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]

Requirements

  • Python interpreter

Connect with me

Notes

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

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)