Sorting algorithms

EasyMediumHard
12345678910111213141516171819202122
Question 5
Easy

Figure 1 shows a sorting algorithm written in pseudocode.

1  values ← [23, 11, 45, 8, 17]
2  n ← 5
3  FOR i ← 0 TO n - 2
4      FOR j ← 0 TO n - i - 2
5          IF values[j] > values[j + 1] THEN
6              temp ← values[j]
7              values[j] ← values[j + 1]
8              values[j + 1] ← temp
9          ENDIF
10     ENDFOR
11 ENDFOR

State one advantage of the quick sort algorithm compared to the sorting algorithm shown in Figure 1.

[1]

Sorting algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Sorting algorithms