Suppose B is a one dimension array with (20) elements. This code sorts B so that its elements are

icon
Related questions
Question
Suppose B is a one dimension array
with (20) elements. This code sorts
B so that its elements are
decreasing.
For I 1 To 19
1-......
2-.
D=B(1)
B(I)=B(J)
B(J)=D
3-...
4-.
O
O
*
1-For J = 1+1 To 20 2-lf B(J) > B(1) Then
3-Endlf 4-Next J, I
1-For J = 1+1 To 20 2-lf B(J) > B(1) Then
3-Next J, 14-Endlf
1-For J = 1+1 To 20 2-lf B(J) > B(1) Then
3-Endlf 4-Next I, J
1-For J = 1 To 20 2-lf B(J) > B(1) Then 3-
Endlf 4-Next J, I
1-For J = 1+1 To 20 2-lf B(J) < B(1) Then
3-Endlf 4-Next J, I
Transcribed Image Text:Suppose B is a one dimension array with (20) elements. This code sorts B so that its elements are decreasing. For I 1 To 19 1-...... 2-. D=B(1) B(I)=B(J) B(J)=D 3-... 4-. O O * 1-For J = 1+1 To 20 2-lf B(J) > B(1) Then 3-Endlf 4-Next J, I 1-For J = 1+1 To 20 2-lf B(J) > B(1) Then 3-Next J, 14-Endlf 1-For J = 1+1 To 20 2-lf B(J) > B(1) Then 3-Endlf 4-Next I, J 1-For J = 1 To 20 2-lf B(J) > B(1) Then 3- Endlf 4-Next J, I 1-For J = 1+1 To 20 2-lf B(J) < B(1) Then 3-Endlf 4-Next J, I
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.