Home > Technology > Sorting Algorithm – Animated Comparison

Sorting Algorithm – Animated Comparison

I came across this cool web site, which explains time complexities of various sorting techniques:

Merge Sort divides the array into two halves, does sorting individually and merges the two in the end. A temporary array is required to perform merging, which is considered additional overhead and primarily not suitable in cases where you’ve strict space constraint. The time complexity in best, worst and average is o(n log n). This sorting technique is used for large sets of data that do not fit completely in fast memory.

Of all Heap sort is the best sorting algorithm with best, average and worst time complexities of o(n log n). Heap primarily competes with merge sort in terms of space complexity, where it requires just o(n) as space complexity.

In cases where the list is in almost sorted order go for Insertion Sort. It can give you almost o(n) best time complexity in case your list is in sorted order. And worst time complexity is o(n^2) [read as: order of n power 2]

Bubble Sort primarily used in case elements are integer format with time complexity of o(n^2)

Selection sort is suitable in cases where you need to select max element in the list. With time complexity same as Bubble Sort o(n^2), its performance however is better than Bubble Sort.

Generally if the time complexity of single processor based sorting technique takes o(n log n) then dual processor takes about o(log n)

Categories: Technology
1. March 17, 2013 at 7:00 PM

Hello my family member! I wish to say that this article is awesome, great written and come with almost all significant infos.
I would like to see extra posts like this .

Like

2. March 25, 2014 at 8:09 AM

I have read so many posts about the blogger lovers except