## Difference Between queue.queue Vs collections.deque In Python

Both Queue and Deque are present in the built-in modules Queue and Collections in Python, both of them are widely used data structures, but they are used for different purposes....

## Implement Stack Queue using Deque

What is Deque? Deque is a double ended queue, i.e. a special kind of queue in which insertion and deletion can be done at the both rear as well as...

## Priority Queue using Binary Heap

What is the priority queue? Priority queues are abstract data structures where each element in the queue has a priority value. For example, in any airline, baggage under the “First-Class”...

## Circular Queue | Set 2 (Circular Linked List Implementation)

Circular Queue It is a linear data structure that works on the principle of FIFO (First in First out). In this type of queue element can be added in any...

## Difference between Circular Queue and Priority Queue

Circular Queue It is a linear data structure that works on the principle of FIFO (First in First out). In this type of queue element can be added in any...

## Sort the Queue using Recursion

Problem Statement: Given a queue, we have to sort the queue using a recursive function without using any loop. We can only use the standard functions for it:- enqueue(element): Add...

## Reversing a Queue

Problem Statement: We have to reverse a queue by using only standard operations:- enqueue(element): Add an element to the rear end of the queue. dequeue(): Delete an element from the...

## Reversing first k elements Queue

Problem Statement: Given a queue, we have to reverse the first k elements which are present in it. What is Queue? A Queue is a linear data structure. Queue follows...

## Reversing Queue using Recursion

Problem Statement: Given a queue, we have to make a recursive function to reverse it. Queue: A Queue is a linear data structure. Queue follows the FIFO rule i.e. First...

## Priority Queue using Doubly Linked List

Problem Statement: Given nodes with their priority, we have to implement a priority queue using a doubly linked list. What is a Priority Queue? Priority queues are abstract data structures...

## Implementation Queue using Javascript

What is a Queue? Queue follows the principle of FIFO (First in First out) i.e. element which is inserted first will be removed first. The operation for insertion of elements...

## Stack, Queue in Python using Module queue

In python, it is quite easy to implement stack and queue data structures. Stack works on the principle of LIFO (Last in First out) i.e. element which is inserted in...

## Priority Queue using Array in C

Priority Queue Priority queues are abstract data structures where each element in the queue has a priority value. For example, in any airline, baggage under the “First-Class” or “Business” arrives...

## Advantages of Circular Queue over Linear Queue

Linear Queue It is a linear data structure that works on the principle of FIFO (First in First out) i.e. the element which is enqueued first will be dequeued first....

## Merge two sorted arrays in Python using heapq

Heap Heap Data structure primarily focuses on representing priority queue. In Python, there is an inbuilt module “heapq” which is used for implementing Heap data structure. By default, Min Heap...

## Merge two Binary Max-Heaps

Binary Max - Heap A binary max - heap follows two conditions: The given tree must be a complete binary tree (All levels are completely filled except the last level...

## K-ary heap

K-ary heaps are similar to the binary heap (where K = 2) just having one difference that instead of 2 child nodes, there can be k child nodes for every...

## Implement stack using Priority Queue or Heap

What is a priority queue? The priority queue is a type of queue data structure having one extra feature of giving priority to every element present in the priority queue....

## Applications of Queue Data Structure

Queue A queue is basically a linear data structure that works on the principle of FIFO (First in First out) which means an element that is enqueued first will be...

## Implementation Binomial Heap

In data structures, a binomial heap is similar to a binary heap that also supports the quick merging of two heaps. What is a Binomial Heap? A binomial heap is...

## Difference between Linear Queue and Circular Queue

Linear Queue It is a linear data structure that works on the principle of FIFO (First in First out) i.e. the element which is enqueued first will be dequeued first....

## Difference Between Array, Queue and Stack

Array: An Array is a collection of elements which are stored in a contiguous memory. The idea is simple i.e. to store the multiple elements together. Due to which we...

## Applications of Priority Queue

A Priority Queue is a special type of queue in which elements present in the queue are served according to their priority i.e. element with the higher priority will be...

## Python Queue using Doubly Linked List

What is a Queue? A queue is a linear data structure that works on the principle of FIFO(First in First out) i.e. the element which is inserted first will be...

## Python Program for Heap Sort

Problem Statement: Given an array, we have to sort it using heap sort. Heap Sort is a sorting algorithm based on the binary heap data structure in which first we...

## Queues in Python

The queue is a linear data structure that works on the principle of First in First out (FIFO). In the queue, the element which is added at least recently is...

## Check if a given Binary Tree is Heap

Problem Statement: Given a binary tree, our task is to check whether the given tree follows the max heap property or not. What is a Binary Tree? Binary tree is...

## Priority Queue in Python

Priority Queue Priority queues are abstract data structures where each element in the queue has a priority value. For example, in any airline, baggage under the “First-Class” or “Business” arrives...

## Stack and Queues in python

In data structures, stack and queue are part of linear data structure. Stack Stack follows the principle of LIFO (Last in First out) i.e. element which is inserted at last...

## How are variables stored in python – Stack or Heap?

Memory allocation is the process of allocating memory to a computer program. In Python, the process of memory allocation and deallocation is handled automatically as there is a garbage collector...