Category: Sorting

Iterative Merge Sort Algorithm (Bottom-up Merge Sort)

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.

Sort an array using one swap

Given an array where all its elements are sorted except two elements which were swapped, sort the array in linear time. Assume there are no duplicates in the array.