Skip to content

Tag Archives: priority-queue

Given a connected graph with N vertices and M edges. The task is to print the lexicographically smallest BFS traversal of the graph starting from… Read More
Given a binary tree and an integer b representing budget. The task is to find the count of maximum number of leaf nodes that can… Read More
Given a max-heap of size n, find the kth greatest element in the max-heap.  Examples: Input : maxHeap = {20, 15, 18, 8, 10, 5,… Read More
Given a min-heap of size n, find the kth least element in the min-heap.  Examples: Input : {10, 50, 40, 75, 60, 65, 45} k… Read More
A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to the values in the… Read More
A double ended priority queue supports operations of both max heap (a max priority queue) and min heap (a min priority queue). The following operations… Read More
The spliterator() method of PriorityQueue returns a Spliterator the same elements as PriorityQueue.The returned Spliterator is late-binding and fail-fast Spliterator. A late-binding Spliterator binds to… Read More
Priority Queues are abstract data structures where each data/value in the queue has a certain priority. For example, In airlines, baggage with the title “Business”… Read More
Given an infinite stream of integers, find the k’th largest element at any point of time. It may be assumed that 1 <= k <=… Read More
Given k sorted arrays of possibly different sizes, merge them and print the sorted output.Examples:  Input: k = 3 arr[][] = { {1, 3}, {2,… Read More
Given an array a, your task is to convert it into a non-increasing form such that we can either increment or decrement the array value… Read More
Prerequisite : Priority Queue, Comparator Priority Queue is like a regular queue, but each element has a “priority” associated with it. In a priority queue,… Read More
Given Nodes with their priority, implement a priority queue using doubly linked list.  Prerequisite : Priority Queue push(): This function is used to insert a… Read More
Given a tree, print the level order traversal in sorted order. Examples :  Input : 7 / \ 6 5 / \ / \ 4… Read More
Implement Priority Queue using Linked Lists.  push(): This function is used to insert a new data into the queue. pop(): This function removes the element… Read More

Start Your Coding Journey Now!