Insertion Sort

Insertion sort is a sorting algorithm runs through each element of a list, consuming one element upon each repetition, and growing a sorted sublist. Upon each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain.

[Example] [Example]
[Resource] [Resource]

Performance
Worst case performance О(n2)
Best case performance Ω(n)
Average case performance О(n2)

Step by Step

Leave a comment