
Advanced Computing Topics: Searching Algorithms and Exception Handling Practical Session
Explore the theories behind searching algorithms, such as linear and binary search, in the context of GCSE computing. Delve into practical application with exception handling and debugging techniques. Engage in hands-on activities to understand and implement these algorithms effectively.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Teaching Computing to GCSE Session 6 Theory: Searching Algorithms Practical: Exception Handling and Debugging
Specification Content OCR Standard searching algorithms: Binary search Linear search AQA Understand and explain how the linear search algorithm works. Understand and explain how the binary search algorithm works. Compare and contrast linear and binary search algorithms. Edexcel Understand how standard algorithms (linear search, binary search) work.
Linear Search Algorithm This is the simplest search algorithm, it works by checking each element in the list in turn until the required value is found. In this example we are looking for the value 7: 6 2 1 4 7 9
index = 0 Activity 1 index = index + 1 searchValue = 4 1. Place these lines of pseudocode to recreate the linear search algorithm. 2. Implement the algorithm in Python. arrayLen = values.length while found == false and index < arrayLen print( Found at index +index) found = true if values[index] == searchValue then endif found = false endwhile array values = [6, 2, 1, 4, 7]
Binary Search Algorithm The binary search algorithm is used to search sorted lists. It starts by finding the mid point and comparing it to the required value. If the value is greater than the midpoint, the left hand side of the list is discarded. If the value is lower than the midpoint, the right hand side of the list is discarded. This process is repeated until the value is found.
Activity 2 This activity will demonstrate a fun way of teaching searching algorithms.
Activity 3 Compare and contrast the linear and binary search algorithms using this table: Algorithm Advantages Disadvantages Linear Search Binary Search
Tracing a Binary Search In an exam the students could be asked to show how the binary search algorithm could be used to search for a particular value in a list. In this example we are looking for 7. 1 2 3 4 5 6 7 8 5 6 7 8 7 8
Activity 4 Show how the value 8 would be found in the list below: 1 2 4 8 16 32 64 128 256 1 2 4 8 4 8 8
Break After the break we will look at exception handling and debugging.