Saltar al contenido

Labs · 9618 A2 19.1

Big O

Run searches and sorts on longer and longer lists and count the comparisons. See what happens when n doubles, predict the count for a bigger list, and name the Big O.

6 levelsFree bench

In the exam

Exam questions on what this lab teaches, with the points that gain marks.

9618/32 May/June 2022 · Question 8(c)3 marks

Compare the performance of the algorithms for a binary search and a linear search using Big O notation for order of time complexity.

Points that gain marks

  1. Linear search is O(n); binary search is O(log n).
  2. The time to search increases linearly with the number of items for a linear search, and logarithmically for a binary search.
  3. The time to search increases less rapidly for a binary search than for a linear search.

In this lab: Levels 1 and 2 run both searches on the same list sizes.

9618/31 May/June 2024 · Question 10(c)2 marks

Describe the performance of a binary search in relation to the number of data items in the array being searched. Refer to Big O notation in your answer.

Points that gain marks

  1. Binary search is O(log n): Big O shows the time complexity of an algorithm.
  2. The time taken increases logarithmically as the number of items increases linearly.
  3. Because the part still to search keeps halving, the number of comparisons stays small.

In this lab: Level 2: doubling n adds just one comparison.

9618/31 October/November 2022 · Question 12(b)(i)1 marks

State the Big O notation for time complexity of a linear search.

Points that gain marks

  1. O(n).

In this lab: Level 1.

The question as printed in the exam paper

More real experiments

All labs →

Iniciar sesión o crear cuenta

IGCSE, A-Level & AP