Skip to content

Commit e8ab08a

Browse files
committed
Insertion sort README file added
1 parent ed5a158 commit e8ab08a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Sorting/Insertion Sort/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Insertion Sort
2+
3+
**Insertion sort** does exactly what you would expect: it inserts each element of the array into its proper position, leaving progressively larger stretches of the array sorted. What this means in practice is that the sort iterates down an array, and the part of the array already covered is in order; then, the current element of the array is inserted into the proper position at the head of the array, and the rest of the elements are moved down, using the space just vacated by the element inserted as the final space.
4+
5+
6+
![Insertion Sort](insertion_sort.jpg)
7+
8+
9+
#### A visualization on Insertion Sort
10+
![Insertion sort demonstration](https://upload.wikimedia.org/wikipedia/commons/0/0f/Insertion-sort-example-300px.gif)
11+
12+
13+
#### Complexity Analysis
14+
- Worst Case - О(n<sup>2</sup>)
15+
- Average Case - О(n<sup>2</sup>)
16+
- Best Case - O(n)
17+
18+
### More on this topic
19+
- [Insertion Sort - WikiPedia](https://en.wikipedia.org/wiki/Insertion_sort)
20+
- [Insertion Sort - geeksforgeeks](http://quiz.geeksforgeeks.org/insertion-sort/)
48.5 KB
Loading

0 commit comments

Comments
 (0)