# Category Archives: Searching

Given a tree with N nodes and (N-1) edges and source node is at 1st position. There are Q queries, each of the type {pos,… Read More
Given an array of string arr[] and a string str, the task is to print all the strings in arr[] that occur as a substring… Read More
Given a binary tree and an integer X, the task is to find out all the occurrences of X in the given tree, and print… Read More
Given two strings A and B, the task is to find the smallest substring of A having B as a subsequence. If there are multiple… Read More
Pre-requisite: Binary Search Bitwise Binary Search algorithm is a modified version of Binary Search based on the following idea: Every number can be represented as… Read More
The binary search algorithm is used in many coding problems, and it is usually not very obvious at first sight. However, there is certainly an… Read More
Given an array arr[] of size N that contains the differences between the adjacents elements of an array. The task is to generate all possible… Read More
Given a vector vec, and integers X and K, the task is to keep replacing X with product of X and K, each time X… Read More
Given an array arr[] denoting the radius of circular pizzas and an integer N denoting the number of friends. The task is to calculate the… Read More
Given an array arr[] of N intervals, the task is to calculate the index of the closest interval to the right of each of the… Read More
Given two stacks stack1[] and stack2[] of size N and M respectively and an integer K, The task is to count the maximum number of… Read More
Given an array of pairs arr[] of size N where the first value of all the pairs are distinct. For each pair of the given… Read More
Given non-negative integers K, M, and an array arr[] with N elements find the Mth element of the array after K left rotations. Examples: Input:… Read More
Given non-negative integers K, M, and an array arr[] with N elements find the Mth element of the array after K left rotations. Examples: Input:… Read More
Given non-negative integers K, M, and an array arr[] with N elements find the Mth element of the array after K left rotations. Examples: Input:… Read More