Sorting algorithms

EasyMediumHard
12345678910111213141516171819202122
Question 11
Easy

Figure 1 shows a sorting algorithm written in pseudocode.

1  data ← [12, 7, 15, 3, 8]
2  n ← 5
3  FOR i ← 1 TO n - 1
4      key ← data[i]
5      j ← i - 1
6      WHILE j >= 0 AND data[j] > key
7          data[j + 1] ← data[j]
8          j ← j - 1
9      ENDWHILE
10     data[j + 1] ← key
11 ENDFOR

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

[1]

Sorting algorithms Questions

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