Overview of Queue Data Structure 🤔🤓
class Queue(object): def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def enqueue(self, data): return self.items.insert(0, data) def dequeue(self): return self.items.pop() def size(self): return len(self.items) q = Queue() print("Is Empty {}".format(q.isEmpty())) q.enqueue(1) q.enqueue(2) q.enqueue(3) print(q.dequeue()) print("Size {}".format(q.size()))
Recommended Reading:
How to start learning Python Programming 👈
Implementation of Stack in Python 👈
If you like my post please follow me to read my latest post on programming and technology.
The formula for the area of a circle is given by πr². Use the Monte…
Given an integer k and a string s, write a function to determine the length…
There is a staircase with N steps, and you can ascend either 1 step or…
Build an autocomplete system that, given a query string s and a set of possible…
Design a job scheduler that accepts a function f and an integer n. The scheduler…
Problem Statement (Asked By Airbnb) Given a list of integers, write a function to compute…