Eduqas A-Level Computer Science A500QS
Data Structures: Arrays, Records and Hash Tables
Stacks, Queues, Linked Lists and Trees
Boolean Logic and Simplification
Algorithms, Pseudo-Code and Programming Constructs
Variables, Scope, Parameters and Identifiers
Recursion and Modular Programming
Sorting Algorithms
Searching and Shortest-Path Algorithms
Big O Notation and Algorithm Efficiency
Validation, Verification and Testing
Data Compression
Programming Paradigms and Computer Languages
Systems Analysis, Maintenance and Documentation
System Design and Human-Computer Interaction
Software Engineering Tools and Translators
Computing, Society and the Law
Computer Architecture, the Processor and Assembly Language
Input, Output and Secondary Storage
Networks, Protocols and the Internet
Data Transmission and Network Performance
Number Systems and Binary Arithmetic
Data Types, Characters and Floating Point
Files, Records and File Organisation
Databases, Normalisation and Entity Modelling
SQL, Big Data and Distributed Systems
The Operating System and Its Modes
Interrupts, Memory Management and Scheduling
Types of Software System
Data Security, Cryptography and Attack
Searching and Shortest-Path Algorithms
Linear search
- 3 things to know
- Component 1
Overview
How a linear search works, main advantage of a linear search and time complexity of a linear search.
What you need to know
Answer each one before you reveal it.
Describe how a linear search works.
What is the main advantage of a linear search?
Questions from this subtopic
Each one with the model answer underneath.
- 1
Describe how a linear search works.
Model answer
A linear search examines each item in turn from the start of the list. The search stops when the target is found or the end of the list is reached.
- 2
What is the main advantage of a linear search?
Model answer
A linear search needs no ordering of the data, so it works on any list. The algorithm is also very simple to write and to check.
- 3
State the worst case number of comparisons a linear search makes on a list of n items.
Model answer
The worst case is n comparisons, which happens when the target is last or absent. A list of twice the length gives twice the worst case.
- 4
How many comparisons does a linear search make on average when the item is present?
Model answer
The average is about half the list, or (n + 1) ÷ 2 comparisons. The figure is roughly 100 for a list of 200 items.
- 5
A linear search looks for 23 in the list 8, 15, 4, 23, 42, 7. How many comparisons are made?
Model answer
Four comparisons are made because 23 sits in the fourth position. The search stops as soon as the item is found.
- 6
A linear search looks for 30 in the list 8, 15, 4, 23, 42, 7. How many comparisons are made?
Model answer
Six comparisons are made because every item must be checked. The search then 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.
Every question in Searching and Shortest-Path Algorithms, 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.