# Category Archives: Searching

Problem: Given a sorted array arr[] of n elements, write a function to search a given element x in arr[] and return the index of… Read More
Problem: Given an array arr[] of n elements, write a function to search a given element x in arr[]. Examples:   Input: arr[] = {10, 20,… Read More
Given an array, write functions to find the minimum and maximum elements in it.  Example: C++ // C++ program to find minimum (or maximum) element… Read More
Given  N coins, the sequence of numbers consists of {1, 2, 3, 4, ……..}. The cost for choosing a number in a sequence is the… Read More
What is Binary Searching? Binary searching is a type of algorithm that can quickly search through a sorted array of elements. The algorithm works by… Read More
What is Sentinel Linear Search? Sentinel Linear search is a type of linear search where the element to be searched is placed in the last… Read More
In this article, we are going to learn how to check if a value is present in an array or not. To do so we… Read More
Given a sorted array arr[] consisting of N integers which denote the position of a stall. You are also given an integer K which denotes… Read More
Given an array arr[] of size N that contains -1 and all positive integers, the task is to modify the array and print the final… Read More
Given an array A[] of N positive integers and 3 integers X, Y, and Z, the task is to check if there exist 4 indices… Read More
Given an N×N matrix mat[][] and an integer K, the task is to search K in mat[][] and if found return its indices. Examples: Input:… Read More
Given an array A[] of N integers, the task is to find the number of pairs of indices (1 ≤ i, j ≤ N) in… Read More
Given a string s of lowercase English alphabets and integer K. the task is to check if each character after increasing their ASCII by K… Read More
Given an array arr[] of distinct elements size N that is sorted and then around an unknown point, the task is to count the number… Read More
Given a binary matrix Mat[][] of size N*N, the task is to find the minimum number of flips to be performed such that the matrix… Read More