Generating Random Unweighted Binary Tree: Since this is a tree, the test data generation plan is such that no cycle gets formed. The number of… Read More

# Tag Archives: cpp-queue

Design a data structure that supports the following operations in queue efficiently: push__front(x): Insert an element at the front of the queue. push__middle(x): Inserts element… 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 an integer N, representing the number of nodes present in an undirected graph, with each node valued from 1 to N, and a 2D… Read More

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

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

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 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

Given a Binary Tree and an integer K, the task is to find the level of the Binary Tree with width K. If multiple levels… Read More

Given an initial array, A[] and a final array B[] both of size N containing integers from the range [1, N], where A[] represent the… Read More

C++ // C++ code #include <iostream> #include <utility> using namespace std; int main() { // Declaring the PAIR1 of int and char // IF… Read More

Given two integers N and M, the task is to find out smallest number of operations required to convert N to M. Each operation involves… Read More

Given a two dimensional grid, each cell of which contains integer cost which represents a cost to traverse through that cell. The task is to… Read More

Given a binary tree, write a function that returns true if the tree satisfies below property: For every node, data value must be equal to… Read More

Find the minimum positive integer such that it is divisible by A and sum of its digits is equal to B

Given two integers A and B, the task is to find the minimum positive integer N such that N is divisible by A and the… Read More