levo

Computational Thinking

Searching and sorting algorithms

  • 3 things to know
  • Paper 1

Overview

Linear and binary searches traced through short lists, worst-case compares, and bubble and merge sorts worked step by step, with when each is the better choice.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Describe how a merge sort puts 6, 2, 8, 4 into ascending order.

Key term

When might a bubble sort be preferred to a merge sort?

Process

How does a linear search work?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    How does a linear search work?

    Model answer

    A linear search checks each item in turn, starting from the first. The search stops when the target is found or the end of the list is reached.

  2. 2

    How does a binary search work?

    Model answer

    A binary search compares the target with the middle item of a sorted list. Half of the remaining list is discarded after each compare, until the target is found or nothing remains.

  3. 3

    What condition must a list meet before a binary search can be used?

    Model answer

    The list must already be sorted into order. A binary search on an unsorted list can miss an item that is present.

  4. 4

    A linear search looks for 9 in the list 4, 7, 1, 9, 3. State how many compares it makes.

    Model answer

    The search makes 4 compares. The values 4, 7 and 1 are checked before 9 is found.

  5. 5

    A binary search looks for 23 in the sorted list 3, 8, 12, 15, 23, 31, 40, choosing the middle item each time. Which items are compared?

    Model answer

    The search compares 15, then 31, then 23. The target is found on the third compare.

  6. 6

    A binary search looks for 30 in the sorted list 4, 9, 16, 25, 36, 49, 64. Which items are compared before the search reports that 30 is absent?

    Model answer

    The search compares 25, then 49, then 36. The remaining sub-list is then empty, so the search reports that 30 is not in the list.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Computational Thinking
Data
Computers
Networks

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

The check is 45 + 27 = 72.
denarybinaryhexadecimal

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AA normal test value is 14.
BA boundary test value is 16.
CAn erroneous test value is 20.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

A kibibyte (KiB) is 1,024 bytes. The figure 1,024 is 2¹⁰.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Computational Thinking, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.