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.
Given an array of integers, duplicates appear in it even number of times except two elements which appears odd number of times. Find both odd appearing element without using any extra memory.
Given an array representing a Min Heap, convert Min Heap into a Max Heap. The conversion should be done inplace and in linear time.
Given an array, reverse every group of consecutive m elements in given subarray of it.
Given an array of integers, find a subset in it that has maximum product of its elements.
Given an unsorted array of integers, print all pairs with given difference k in it without using any extra space.
Given an unsorted array of integers, print all pairs with given difference k in it.
Given a sorted array containing duplicates, efficiently find frequency of each element in it without traversing the whole array.
In this post, we will discuss how to shuffle or randomize a List in Java using Fisher–Yates shuffle algorithm and shuffle() method provided by the Collections class.
Given an array of integers, duplicates are present in it in such a way that all duplicates appear even number of times except one which appears odd number of times. Find that odd appearing element in linear time and without using any extra memory.
Quickselect is a selection algorithm to find the kth smallest element in an unordered list. It is closely related to the quicksort sorting algorithm.