Sorting algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637
Question 22
Medium

A technician at a logistics hub is using a sorting algorithm to arrange five cargo crates by weight. The initial unsorted weights (in tonnes) of the crates are recorded in the array [3,5,2,1,4][3, 5, 2, 1, 4][3,5,2,1,4].

Complete the table below to show the step-by-step state of the array when applying a bubble sort algorithm to sort these weights into ascending order.

You only need to write the state of the array after each individual swap (change) occurs.

35214
12345
[5]

Sorting algorithms Questions

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