# Category Archives: Data Structures

Given two Geometric Progressions (a1, r1) and (a2, r2) where (x, y) represents GP with initial term x and common ratio y and an integer… Read More
Given an array of pairs arr[][] of length N, and an array queries[] of length M, and an integer R, where queries[i] contain an integer… Read More
Johnson’s algorithm finds the shortest paths between all pairs of vertices in a weighted directed graph. It allows some of the edge weights to be… Read More
Given a Matrix grid[][] of size NxM where N is number of rows and M is number of columns. The task is to form a… Read More
Given N integers, the task is to insert those elements in the queue. Also, given M integers, the task is to find the frequency of… Read More
Given a Generic Tree consisting of N nodes valued from 0 to (N – 1) where P[i]th in the array P[] denotes ith nodes parent(1-based… Read More
Given a binary string S of size N, the task is to check if the count of 1s can be made greater than the count… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to find the minimum of operations required to make all… Read More
Given a circular array arr[] of N integers and two integer M and K, the task is to find the sum of array elements arr[]… Read More
Given a string S of size N consisting of digits and ?, the task is to find the number of strings formed such that replacing… Read More
Given two arrays arr[](1-based indexing) and queries[] consisting of N integers and queries[] contains a permutation of the first N natural numbers, the task is… Read More
Given a positive integer N and an array arr[] consisting of K integers and consider a binary string(say S) having N set bits, the task… Read More
Given three positive integers A, B, and K, the task is to find the Kth lexicographically smallest binary string that contains exactly A number of… Read More
Given an undirected graph G(V, E)  consisting of2 N vertices and M edges, the task is to find the smallest vertex in the connected component… Read More
Given an array of pairs arr[][] of length N, and an array queries[] of length M, and an integer R, where each query contains an… Read More