Insertion Sort Project [22,27,16,2,18,6]
֎ 1-Write the stages of the above array according to the sort type.
֎ 2-Write Big-O Notation.
֎ 3-Time Complexity: Average case: The number we are looking for is in the middle, Worst case: The number we are looking for is in the last, Best case: The number we are looking for is in the first.
֎ 4-What case does the number 18 fall into after the array is sorted? Write.
֎ 5-[7,3,5,8,2,9,4,15,6] Write the first 4 steps of the array according to Insertion Sort:
Insertion Sort Stages:
[22,27,16,2,18,6] - (n)
[2,27,16,22,18,6] - (n-1)
[2,6,16,22,18,27] - (n-2)
[2,6,16,18,22,27] - (n-3)
Big O Notation:
Worst Case: O(n²) = n+(n-1)+(n-2)....+1
Average Case: O(n²)
Best Case: O(n)
Time Complexity Worst Case: [27,22,18,16,6,2]
Best Case: [2,6,16,18,22,27]
Avarage Case: [2,6,16,18,22,27]
[7,3,5,8,2,9,4,15,6] First 4 Steps of the Series
[2|,3,5,8,7,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]