A PLATFORM TO LEARN | CODE | ACHIEVE
" Programming is the real test of your creativity,its all about how you turn ideas into codes. "
Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. However, insertion sort provides several advantages.
To begin,the leftmost number is considered fully sorted.Next,from the remaining numbers the leftmost number is taken out and compared to the already number to its left.If the already sorted number is larger,the two number swaps.This operation repeats until a number smaller appears,or the number reaches the left edge.
Worst-case performance : O(n2)
Best-case performance : O(n)
Average performance : O(n2)
***** INSERTION SORT - CODE OF GEEKS *****
ENTER THE NUMBER OF ELEMENTS ?
ENTER THE ARRAY :
SORTED ARRAY :
12 12 23 26 35 53
INTERESTING READ FOR YOU :
For any Queries,suggestions,feel free to Mail us at :
For reporting any kind of copyright voilation,mail us at : firstname.lastname@example.org
© copyright CODE OF GEEKS 2018