A bubble sort could be used to sort a list of planet names into alphabetical (ascending) order.
Figure 1 shows the pseudocode algorithm for this bubble sort.
Figure 1
1 SET planets TO ["Venus", "Mars", "Earth", "Saturn", "Jupiter"]
2 SET temp TO ""
3 SET swapped TO True
4 SET size TO LENGTH(planets)
5
6 WHILE (swapped = True) DO
7 SET swapped TO False
8 FOR i FROM 0 TO size - 2 DO
9 IF planets[i] > planets[i + 1] THEN
10 SET temp TO planets[i]
11 SET planets[i] TO planets[i + 1]
12 SET planets[i + 1] TO planets[i]
13 SET swapped TO True
14 END IF
15 END FOR
16 END WHILE
There is a logic error in the swap process between line 9 and line 14.
Complete the table to identify the line number containing the error and write the corrected line of pseudocode.
| Line Number with Error | Corrected Line of Pseudocode |
|---|---|