Computer Science HL
Paper 1
Questions Attempted 0/1
Computer Science HL
Available time 20 Minute(s)
01

Identify two differences and two similarities between a bubble sort and a selection sort when sorting an array of 10 elements.

Paper 1
:
Available time 20 Minute(s)
01. Question
Level Medium
Maximum Mark 15
Report a bug
Tell us how we can help

(a). Identify two differences and two similarities between a bubble sort and a selection sort when sorting an array of 10 elements.

[Marks: 4]

A cycling tour lasts for 15 days. The total time for each competitor is recorded in a one-dimensional array, TIMES[]. After each day’s race, the array entry for each competitor is increased by their time for that day.

There are 150 competitors and the 10 fastest times are transferred to the array FASTEST[] and displayed on a screen each day

(b). Explain why a selection sort would be more efficient than a bubble sort in this case.

[Marks: 2]

(c). Construct an algorithm to transfer the 10 fastest times from the array TIMES[] to the array FASTEST[]. Assume that the array TIMES[] is not sorted.

[Marks: 6]

The race organizers need to display the names of the 10 fastest competitors, as well as their times, on the screen. There is another array, NAMES[], which contains the names of all competitors in the same order as their times in TIMES[] (for example, NAMES[5] and TIMES[5] are the name and time of the same competitor).

(d). Compare the use of two arrays, to hold the competitor’s times and names, with the use of objects.

[Marks: 3]
Loading...