[22,27,16,2,18,6] -> Insertion Sort
- [2,27,16,22,18,6]
- [2,6,16,22,18,27]
- [2,6,16,18,22,27]
Big O Notation--->O(n2) Time Complexity of this array is average case(For 18)
[7,3,5,8,2,9,4,15,6]
- [2,3,5,8,7,9,4,15,6]
- [2,3,4,8,7,9,5,15,6]
- [2,3,4,5,7,9,8,15,6]
- [2,3,4,5,6,9,8,15,7]
- [2,3,4,5,6,7,8,15,9]
- [2,3,4,5,6,7,8,9,15]
[16,21,11,8,12,22] -> Merge Sort
- [16,21,11] [8,12,22]
- [16] [21,11] [8,12] [22]
- [16] [21] [11] [8] [12] [22]
- [16] [21,11] [8,12] [22]
- [11,16,21] [8,12,22]
- [8,11,16,21,22]
Big O Notation--->O(nlogn)
[7, 5, 1, 8, 3, 6, 0, 9, 4, 2]
[5]
[2] [8]
[0][1] [3][4] [7] [6][9]