## Print the lexicographically smallest BFS of the graph starting from 1

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 »

## Maximum number of leaf nodes that can be visited within the given budget

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 »

## K-th Greatest Element in a Max-Heap

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 »

## K’th Least Element in a Min-Heap

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 »

## Max Heap in Java

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 »

## Double ended priority queue

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 »

## PriorityQueue spliterator() method in Java

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 Queue in Python

Priority Queue is an extension of the queue with following properties. 1) An element with high priority is dequeued before an element with low priority.… Read More »

## Kth smallest element after every insertion

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 »

## Merge k sorted arrays | Set 2 (Different Sized Arrays)

Given k sorted arrays of possibly different sizes, merge them and print the sorted output. Examples: Input: k = 3 arr[][] = { {1, 3},… Read More »

## Minimum increment/decrement to make array non-Increasing

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 »

## Implement PriorityQueue through Comparator in Java

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 »

## Priority Queue using doubly linked list

Given Nodes with their priority, implement a priority queue using doubly linked list. Prerequisite : Priority Queue Operations on Priority Queue : push(): This function… Read More »

## Print Binary Tree levels in sorted order | Set 2 (Using set)

Given a tree, print the level order traversal in sorted order. Examples : Input : 7 / \ 6 5 / \ / \ 4… Read More »

## Priority Queue using Linked List

Implement Priority Queue using Linked Lists. Operations on Priority Queue : push(): This function is used to insert a new data into the queue. pop():… Read More »