Skip to content

Files

Latest commit

97ec8d6 · May 12, 2020

History

History

algorithm_and_datastructure

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)