Skip to content

Category Archives: Searching

Given a matrix mat[][], the task is to count the number of columns that are sorted in descending. Examples: Input: mat[][] = {{1, 3}, {0,… Read More
Given an array of N integers. The task is to find the smallest index of an element such that when multiplied by -1 the sum… Read More
Given an array of integers, find the closest smaller or same element for every element. If all elements are greater for an element, then print… Read More
Given an array of distinct integers arr[], the task is to find a pair which has the minimum sum and print the sum. Examples: Input:… Read More
Given an array of integers, find the closest smaller or same element for every element. If all elements are greater for an element, then print… Read More
Given an array arr, the task is to print the elements of the array in descending order along with their frequencies. Examples: Input: arr[] =… Read More
Given an integer k and a monotonic increasing sequence: f(n) = an + bn [log2(n)] + cn^3 where (a = 1, 2, 3, …), (b… Read More
Given a square matrix of order n*n, find the smallest and largest elements from both diagonals of the given matrix. Examples:  Input : matrix = {… Read More
Given an array containing N elements. Find if it is possible to sort it in non-decreasing order using atmost one swap. Examples: Input : arr[]… Read More
Given two matrix A[][] and B[][] of same order m*n. The task is to find the intersection of both matrix as C, where:  Cij =… Read More
In this searching method, first of all, an index file is created, that contains some specific group or division of required record when the index… Read More
Given an array A[] of N integers. The task is to find the number of triples (i, j, k) , where i, j, k are… Read More
Given an integer K and two arrays A1 and A2, the task is to return the total number of pairs (one element from A1 and… Read More
Given an array A[]. The task is to determine if it is possible to choose two indices ‘i’ and ‘j’ such that the below conditions… Read More
Given an array A[] of integers. The task is to find the total number of ordered pairs of positive integers (X, Y) such that X… Read More