Skip to content

Course home

Sign up

Computational thinking

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
Question 65

A flight booking system uses the following algorithm to sort flight data:

# flightDirectory has the format [flightNumber, destination, passengers]

PROCEDURE bubbleSortFlights()
    SET temporary TO []
    FOR outer FROM 0 TO LENGTH(flightDirectory) - 1 DO
        FOR inner FROM 0 TO LENGTH(flightDirectory) - 2 DO
            IF flightDirectory[inner, 2] > flightDirectory[inner + 1, 2] THEN
                SET temporary TO flightDirectory[inner]
                SET flightDirectory[inner] TO flightDirectory[inner + 1]
                SET flightDirectory[inner + 1] TO temporary
            END IF
        END FOR
    END FOR
END PROCEDURE

State the specific type of data structure represented by flightDirectory in this algorithm.

[1]
Markscheme

Computational thinking Questions

  1. GCSE
  2. /Computer Science
  3. /Computational thinking

Question bank