Skip to content

Course home

Sign up

Computational thinking

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
Question 79

An oceanographic research database uses the following algorithm to sort marine biodiversity logs:

# surveyLog has the format [speciesCode, commonName, observationDepth]

PROCEDURE sortSurveyData()
    SET temp TO []
    SET n TO LENGTH(surveyLog)
    FOR i FROM 0 TO n - 1 DO
        FOR j FROM 0 TO n - i - 2 DO
            IF surveyLog[j, 2] < surveyLog[j + 1, 2] THEN
                SET temp TO surveyLog[j]
                SET surveyLog[j] TO surveyLog[j + 1]
                SET surveyLog[j + 1] TO temp
            END IF
        END FOR
    END FOR
END PROCEDURE

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

[1]
Markscheme

Computational thinking Questions

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

Question bank