In: Computer Science
PLEASE ANSWER IN PSEUDOCODE USING BUBBLE FULLY --- trying to understand steps for a test
Question 4) Sorting: Sort {5 4 3 2 1} into ascending order using the sorting algorithm of your choice (Bubble, Exchange, Insertion or Selection). You must show each movement of the sort to get any credit (no need to write down the algorithm) (15 points)
INSERTION_SORT (A)
1. FOR j ← 2
TO length[A]
2. DO key
← A[j]
3.
{Put A[j] into the sorted sequence A[1 .
. j − 1]}
4. i
← j − 1
5. WHILE
i > 0 and A[i] > key
6. DO
A[i +1] ←
A[i]
7. i
← i − 1
8. A[i
+ 1] ← key