Given an integer N denoting the number of connected cities ( numbered from 1 to N ) and a 2D array arr[][] consisting of pairs… Read More

# Category Archives: Queue

Priority Queue is an extension of the Queue data structure where each element has a particular priority associated with it. It is based on the… Read More

Given a Binary Tree consisting of N nodes, the task is to count the number of levels in a Binary Tree such that the set… Read More

Given a grid mat[][] of size M * N, consisting of only 0s, 1s, and 2s, where 0 represents empty place, 1 represents a person… Read More

Given an integer N which denotes the number of slots, and an array arr[] consisting of K integers in the range [1, N] repreand. Each… Read More

Given a Binary Tree, the task is to replace the value of each node with the sum of all the nodes present in the same… Read More

Given a Binary Tree consisting of 0s and 1s only, the task is to print the count of levels in the Binary Tree in which… Read More

Given a character array, str[] of consisting of N lowercase alphabets, and an integer array, arr[] consisting of numbers in the range [0, N –… Read More

Given a Binary Tree, the task is to find the most frequent subtree sum that can be obtained by considering every node of the given… Read More

Linear Queue: A Linear Queue is generally referred to as Queue. It is a linear data structure that follows the FIFO (First In First Out)… Read More

Given a Binary tree consisting of N nodes with values in the range [1, N], the task is to find the distance from the root… Read More

Given a positive integer N, representing the count of players playing the game and an array of strings arr[], consisting of the numeric strings made… Read More

Queue: A Queue is a linear data structure that follows a First In First Out (FIFO) order in which the operations are performed. It is… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to find the Kth smallest element in the array using… Read More