Question: [1] Please draw a flowchart to explain the insertion sort algorithm below. Insertion Sort algorithm is defined by the following steps: Step, Operation 01. set
[1] Please draw a flowchart to explain the insertion sort algorithm below.
Insertion Sort algorithm is defined by the following steps: Step, Operation 01. set Array is an unsorted numeric array. 02. set n = Length of Array 03. set i = 1 04. if i < n : 05. set Element = Array[i] 06. set j = i - 1 07. if j >= 0 AND Array[j] > Element : 08. set Array [j + 1] = Array [j] 09. decrement j (j--) 10. else : 11. Array[j + 1] = Element 12. Increment i (i++) 13. Go back LINE 04 14. else : 15. print("A sorted array is ready.") 16. stop
[2] Big-O for Insertion sort algorithm
1.Worst case performance: _________________ 2.Best case performance: _________________ 3.Average case performance: _____________ 4.Worst case space complexity: _______________
[3] Draw a diagram for each step and illustrate the operation of insertion sort algorithm, which sorts the numbers in ascending order, on the following list of numbers.
int[] DataArray={0, 9, 88, 7, 0, 5, 3, 19, 7}
[4] Consider the following array
int[] DataArray={0, 9, 88, 7, 0, 5, 3, 19, 7}
Draw a diagram for each step and illustrate the operation of shuffle-left algorithm to clean up ZERO data.
[5] Consider the following array
int[] DataArray={0, 9, 88, 7, 0, 5, 3, 19, 7}
Draw a diagram for each step and illustrate the operation of copy-over algorithm to clean up ZERO data.
[6]Consider the following array
int[] DataArray={0, 9, 88, 7, 0, 5, 3, 19, 7}
Draw a diagram for each step and illustrate the operation of converging-pointers algorithm to clean up ZERO data.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
