Given the following unordered array:
[0] |
[1] |
[2] |
[3] |
[4] |
[5] |
[6] |
[7] |
[8] |
[9] |
[10] |
W |
X |
D |
T |
P |
N |
R |
Q |
K |
M |
E |
If the array was being sorted using the SHELL sort and the halving method,
and sorting into ASCENDING order as demonstrated in the course content,
list the letters in the resulting array, in order AFTER the FIRST pass.
[0] |
[1] |
[2] |
[3] |
[4] |
[5] |
[6] |
[7] |
[8] |
[9] |
[10] |
In pass1,
Each sublist q starts with index 0 and it has elements at index 0,(0+5).
Next sublist has elements with index 1, (1+5).
Similarly all sublists have such elements till all elements are entered into sublists.
Then,
In each sublist, elements are sorted in ascending. After sorting elements in each sublist, finally all elements are traced from each index. Hence we get elements after pass 1 as shown below.
Thank you.
Get Answers For Free
Most questions answered within 1 hours.