GCSE

Computer Science

  1. Introduction to GCSE Computer Science
  2. 1. Computer Systems

  3. 1.1 Systems Architecture
  4. 1.2 Memory and Storage
  5. 1.3 Computer Networks, Connections and Protocols
  6. 1.4 Network Security
  7. 1.5 Systems Software
  8. 1.6 Ethical, Legal, Cultural and Environmental Impacts of Digital Technology
  9. 2. Computational Thinking, Algorithms and Programming
  10. 2.1 Algorithms
  11. 2.2 Programming Fundamentals
  12. 2.3 Producing Robust Programs
  13. 2.4 Boolean Logic
  14. 2.5 Programming Languages and Integrated Development Environments
Module Progress
0 / 35 Lessons
0%
Learning
Summary
Revision

In this lesson, we will explore standard searching algorithms (Binary Search and Linear Search) and standard sorting algorithms (Bubble Sort, Merge Sort, and Insertion Sort). You will understand the main steps of each algorithm, any prerequisites, how to apply them to a data set, and how to identify an algorithm when given its code or pseudocode.

Standard Searching Algorithms

Searching algorithms help locate specific elements in a dataset. Two common methods are binary search and linear search. Binary search quickly finds a target in a sorted list, while linear search checks each element one by one. This means that binary search is faster and more efficient than linear search for large lists and datasets.

Binary Search

The list must be sorted before applying binary search.

  1. Start with a sorted list of elements.
  2. Define the search boundaries: low index (start) and high index (end) of the list.
  3. Calculate the middle index.
  4. Compare the middle element with the target value.
  5. If the middle element matches the target value, the search is successful.
  6. If the target value is smaller than the middle element, update the high index to (middle - 1) and repeat from step 3.
  7. If the target value is larger than the middle element, update the low index to (middle + 1) and repeat from step 3.
  8. Continue the process until the target value is found or the low index is greater than the high index, indicating that the value is not in the list.

Linear Search

  1. Start at the beginning of the list.
  2. Compare each element sequentially with the target value.
  3. If the target value is found, the search is successful.
  4. If the end of the list is reached without finding the target value, the search is unsuccessful.

*Add advantages

Continue learning with Knowness

Sign up to access the full lesson, predicted grades, revision tools, progress tracking, and more.

Create a free account