## Find majority element in an array (Boyer–Moore majority vote algorithm)

Given an array of integers containing duplicates, return the majority element in an array if present. A majority element appears more than n/2 times where n is the size of the array.

## Find Equilibrium Index of an Array

Given an array of integers, find equilibrium index in it.

## Shuffle a given array of elements (Fisher–Yates shuffle)

Given an array of integers, in-place shuffle it. The algorithm should produce an unbiased permutation i.e. every permutation is equally likely.

## Find Pair with given Sum in the Array

Given an unsorted array of integers, find a pair with given sum in it.

## Sort an array containing 0’s, 1’s and 2’s (Dutch national flag problem)

Given an array containing only 0’s, 1’s and 2’s, sort the array in linear time and using constant space.

## Sort Binary Array in Linear Time

Given an binary array, sort it in linear time and constant space. Output should print contain all zeroes followed by all ones.

## Rearrange the array with alternate high and low elements

Given an array of integers, rearrange the array such that every second element of the array is greater than its left and right elements. Assume no duplicate elements are present in the array.

## Floor and Ceil in a Binary Search Tree

Given a BST, find floor and ceil of a given key in it. If the given key lie in the BST, then both floor and ceil is equal to that key, else ceil is equal to next greater key (if any) in the BST and floor is equal to previous greater key (if any) in …

## Find K’th smallest and K’th largest element in BST

Given a Binary Search Tree and a positive number K, find K’th smallest and K’th largest element in BST.

## Find Lowest Common Ancestor (LCA) of two nodes in a BST

Given a BST and two nodes x and y in it, find lowest common ancestor (LCA) of x and y in it.

## Find inorder predecessor for given key in a BST

Given a BST, find in-order predecessor of a given key in it. If the given key do not lie in the BST, then return the previous greater key (if any) present in the BST.   An in-order predecessor of a node in BST is the previous node in in-order traversal of it.

## Check if given keys represents same BSTs or not without building the BST

Given two arrays which represents set of BST keys, check if they represents same BSTs or not. We are not allowed to build the tree.