levo

Algorithms and Programs

Standard algorithms: sorting, searching and compression

  • 3 things to know
  • AS Unit 1

Overview

How a bubble sort puts a list into order, how an insertion sort puts a list into order and one advantage of an insertion sort over a bubble sort.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

State the number of comparisons made by the first pass of a bubble sort on a list of 10 items.

Key term

Describe how a linear search finds a value.

Key term

State what must be true of a list before a binary search can be used on it.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Describe how a bubble sort puts a list into order.

    Model answer

    A bubble sort compares each adjacent pair in turn and swaps them if they are the wrong way round, repeating these passes until a whole pass makes no swap, with the largest value reaching the end after the first pass.

  2. 2

    How does a bubble sort detect that the list is already in order?

    Model answer

    It records whether any swap was made during a pass, and a pass that makes no swap at all shows every adjacent pair is in order so the sort can stop.

  3. 3

    State the number of comparisons made by the first pass of a bubble sort on a list of 10 items.

    Model answer

    The first pass makes 9 comparisons, because it compares each of the 10 items with the one after it.

  4. 4

    Describe how an insertion sort puts a list into order.

    Model answer

    An insertion sort takes each item in turn from the unsorted part and moves it back past every larger item until it sits in its correct place among those already sorted.

  5. 5

    State one advantage of an insertion sort over a bubble sort.

    Model answer

    An insertion sort does far less work on a list that is already nearly in order, because each item usually needs no movement at all.

  6. 6

    Describe how a linear search finds a value.

    Model answer

    A linear search examines each item from the beginning in turn, comparing it with the value wanted, and stops when it finds a match or reaches the end of 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.

Hardware: Architecture, Memory and Storage
Networks and Data Transmission
Logic Gates and Boolean Algebra
Data Representation and Data Types

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.

Fetch, , execute.
decodecompilestore

Blank Blitz makes facts automatic

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

AEncryption is reversible.
BThe stored form could be decrypted.
CA hash cannot be reversed.

Build It gets the exam shape right

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

A bit is a single binary digit.
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 Algorithms and Programs, 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.