Skip to main content
Northern IrelandSoftware Systems DevelopmentSyllabus dot point

How are arrays, lists and records used to hold an application's data, and how are linear and binary search and a simple sort carried out?

Storing application data in arrays, lists and records, and the standard algorithms - linear search, binary search and a simple sort such as bubble sort.

A CCEA A-Level Software Systems Development answer on storing application data in arrays, lists and records, and the standard algorithms: linear search, binary search and a simple sort such as bubble sort, with their requirements and trade-offs.

Generated by Claude Opus 4.813 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

CCEA wants you to store an application's data in arrays, lists and records, and to apply the standard algorithms: linear search, binary search and a simple sort such as bubble sort. You must define a record (grouped fields of mixed types) and an array of records, describe each algorithm, state the requirement of binary search (sorted data) and the trade-offs between the approaches. Tracing or writing these algorithms, and choosing the right structure, are examined directly.

The answer

Arrays, lists and records

A record keeps all the data about one thing together, which is clearer and safer than several parallel arrays. An array (or list) of records is the natural store for an application's table of data loaded from a file.

Searching

Sorting with a bubble sort

A bubble sort orders a list by repeatedly passing through it, comparing each adjacent pair and swapping them if they are in the wrong order. Each pass moves the next-largest value to its correct end position; passes continue until a pass makes no swaps, meaning the list is sorted.

repeat
    swapped = false
    for i = 0 to length - 2
        if list[i] > list[i+1] then
            swap list[i] and list[i+1]
            swapped = true
        end if
    next i
until swapped = false

Bubble sort is simple but slow on large lists; it is the standard introductory sort CCEA expects you to describe and trace.

Worked example: tracing a binary search

Examples in context

Example 1. A contacts application. Each contact is a record with name, phone and email; the address book is an array of these records, loaded from a file at start-up. A linear search finds a contact by name in the unsorted list, and a bubble sort can order the array alphabetically so it displays tidily and, once sorted, a binary search can find a name quickly.

Example 2. A library catalogue. Thousands of book records are kept sorted by ISBN. A binary search locates a title in roughly a dozen comparisons rather than the thousands a linear search might need, showing why keeping data sorted pays off when lookups are frequent and the dataset is large.

Try this

Q1. State one requirement of a binary search that a linear search does not have. [1 mark]

  • Cue. The list must already be sorted on the search key.

Q2. Define a record and give an example of the fields it might contain. [2 marks]

  • Cue. A record groups related fields of possibly different types under one name, for example a Book record with title (string), year (integer) and available (Boolean).

Q3. State the condition that tells a bubble sort the list is fully sorted. [1 mark]

  • Cue. A complete pass through the list makes no swaps.

Exam-style practice questions

Practice questions written in the style of CCEA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

CCEA 20186 marksExplain the difference between a linear search and a binary search, and state a requirement and a relative advantage of the binary search.
Show worked answer →

A linear search checks each element of a list in turn, from the first to the last, until it finds the target or reaches the end. It works on any list, sorted or unsorted, but on a large list it can be slow because it may examine every element.

A binary search works only on a sorted list. It checks the middle element; if that is the target the search ends, if the target is smaller it repeats on the lower half, and if larger on the upper half, halving the search range each time. Its requirement is that the data must already be sorted. Its advantage is speed: by discarding half the remaining items at every step it finds the target in far fewer comparisons than a linear search on a large list (about log to base 2 of n comparisons rather than up to n).

Markers reward the sequential-versus-halving descriptions, the requirement that binary search needs sorted data, and the advantage that binary search is much faster on large sorted lists.

CCEA 20216 marksDescribe how a bubble sort orders a list of numbers into ascending order, and explain why a record is a useful data structure in an application.
Show worked answer →

A bubble sort repeatedly passes through the list comparing each adjacent pair of elements and swapping them if they are in the wrong order (the larger before the smaller for ascending order). Each complete pass moves ("bubbles") the next-largest value to its correct position at the end. Passes continue until a full pass makes no swaps, which means the list is sorted.

repeat
    swapped = false
    for i = 0 to length - 2
        if list[i] > list[i+1] then
            swap list[i] and list[i+1]
            swapped = true
        end if
    next i
until swapped = false

A record is a data structure that groups related fields of possibly different types under one name, for example a Student record with a name (string), a year (integer) and a mark (real). It is useful because it keeps all the data about one thing together as a single unit, which is clearer and safer than several parallel arrays, and an array of records can store many such things.

Markers reward the adjacent-compare-and-swap description with passes until no swaps, and a correct definition of a record (grouped related fields of mixed types) with a reason it is useful.

Related dot points

Sources & how we know this