# Category: Search Algorithms

## Find the element which appears maximum number of times in the array.

Objec­tive: Given an array of inte­gers, write a algo­rithm to find the ele­ment which appears max­i­mum num­ber of times in the array. Exam­ple: int [] arrA = {4, 1, 5, 2, 1, 5, 9, 8,…

## Find duplicates in an given array in O(n) time and O(1) extra space.

Objec­tive: Given an array of inte­gers, find out dupli­cates in it. Exam­ple: int [] a = {4, 6, 2, 1, 2, 5}; Out­put: Array has dupli­cates : 2 int a [] = {1, 6, 5,…

## Track the Maximum Element in a Stack.

Objec­tive: In a Stack, keep track of max­i­mum value in it. It might be the top ele­ment in the stack but once it is poped out, the max­i­mum value should be from the rest…

## Search an Element in a Rotated Sorted Array

Input: Rotated Sorted Array. What is Rotated Sorted Array. A sorted array is rotated around some pivot ele­ment. See the Exam­ple Below, array is rotated after 6. Approach:

## Find a peak element in a Given Array

Objec­tive : In this arti­cle we will dis­cuss an algo­rithm to Find a peak ele­ment in a Given Array. We will see the recur­sion tech­niques to solve this prob­lem. Peak Ele­ment: peak ele­ment is…

## Binary Search

Objec­tive : Write an algo­rithm to find an ele­ment in an sorted array Input: A sorted array, arrA[] and an key Out­put : Return true if ele­ment is found, else false. Approach: The idea is to…