Given an sorted array of integers, find a pair in it having minimum absolute sum.
Given a collection of integers, develop an algorithm to find the index of maximum occurring element with equal probability.
Given an array of integers, check if an array is formed by consecutive integers.
Given an unsorted array of integers, find two non-overlapping pairs in it having same sum.
Given a sequence of numbers such that the difference between the consecutive terms is constant, find missing term in it in log(n) time.
Given a set S, generate all distinct subsets of it i.e., find distinct power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.
Given a sorted array of integers, find floor and ceil of a given number in it. The floor and ceiling map the given number to the largest previous or the smallest following integer, respectively.
Given an binary array of size two having alteast one element as zero, write a single line function to set both its elements to zero. Use of ternary operator and direct assignment of elements are not allowed.
In k-partition problem, we need to partition an array of positive integers into k disjoint subsets that all have equal sum and they completely covers the set.
3-partition problem: Given a set S of positive integers, determine if it can be partitioned into three disjoint subsets that all have same sum and they cover S.
In this post, we will see how to sort an array of integers using iterative merge sort algorithm. Merge sort is an efficient sorting algorithm which falls under divide and conquer paradigm and produces a stable sort.
Given an unsorted array of integers whose each element lies in range 0 to n-1 where n is the size of the array, rearrange array such that A[A[i]] is set to i for every element A[i] in the array.