Teaching Computing to GCSE

Slides:



Advertisements
Similar presentations
Standard Algorithms. Many algorithms appear over and over again, in program after program. These are called standard algorithms You are required to know.
Advertisements

Search and Recursion CS221 – 2/23/09. List Search Algorithms Linear Search: Simple search through unsorted data. Time complexity = O(n) Binary Search:
Searching Arrays Linear search Binary search small arrays
Searching and Sorting Arrays
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 9 Searching.
Chapter 8 ARRAYS Continued
SEARCHING UNIT II. Divide and Conquer The most well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 9 Searching Arrays.
Starting Out with C++, 3 rd Edition 1 Searching an Arrays.
DATA STRUCTURE & ALGORITHMS (BCS 1223) CHAPTER 8 : SEARCHING.
SEARCHING. Vocabulary List A collection of heterogeneous data (values can be different types) Dynamic in size Array A collection of homogenous data (values.
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Searching Course Lecture Slides 28 May 2010 “ Some things Man was never.
Searching. Linear (Sequential) Search Search an array or list by checking items one at a time. Linear search is usually very simple to implement, and.
Searching Damian Gordon. Google PageRank Damian Gordon.
CSC 211 Data Structures Lecture 13
CHAPTER 8 SEARCHING CSEB324 DATA STRUCTURES & ALGORITHM.
Chapter 9 slide 1 Introduction to Search Algorithms Search: locate an item in a list (array, vector, table, etc.) of information Two algorithms (methods):
Searching & Sorting Programming 2. Searching Searching is the process of determining if a target item is present in a list of items, and locating it A.
CAPTER 6 SEARCHING ALGORITHM. WHAT IS SEARCHING Process of finding an item in an array Two ways to find an item By position / By value.
New Mexico Computer Science For All Search Algorithms Maureen Psaila-Dombrowski.
Chapter 9 Sorting. The efficiency of data handling can often be increased if the data are sorted according to some criteria of order. The first step is.
Searching & Sorting. Algorithms Step by step recipe to do a task…
 Introduction to Search Algorithms  Linear Search  Binary Search 9-2.
CMPT 120 Topic: Searching – Part 2 and Intro to Time Complexity (Algorithm Analysis)
Exam practice. Exam 1  Describe how a Boolean expression can control the operation of a loop  Describe the difference between a while loop and for loop.
OCR A Level F453: Data structures and data manipulation Data structures and data manipulation a. explain how static data structures may be.
Searching Arrays Linear search Binary search small arrays
Searching and Sorting Arrays
Searching and Sorting Algorithms
CMPT 120 Topic: Searching – Part 2
COP 3503 FALL 2012 Shayan Javed Lecture 15
Section 2.6: Searching and Sorting
Lesson Objectives Aims Understand the following “standard algorithms”:
Standard Algorithms Higher Computing.
Teaching Computing to GCSE
Sorting Data are arranged according to their values.
Teaching Computing to GCSE
Adapted from Pearson Education, Inc.
Last Class We Covered Data representation Binary numbers ASCII values
Searching.
Introduction to Search Algorithms
Data Structures and Organization (p.2 – Arrays)
Teaching Computing to GCSE
Teaching Computing to GCSE
Databases Lesson 2.
Teaching Computing to GCSE
Sorting Data are arranged according to their values.
Searching and Sorting Arrays
Standard Version of Starting Out with C++, 4th Edition
Python Camp Alan led this session looking at slicing strings and allowing further practice. Session 10: The Examined Component Specifications Overview.
UNIT – V PART - I Searching By B VENKATESWARLU, CSE Dept.
Searching: linear & binary
Binary Search Binary search. Given value and sorted array a[], find index i such that a[i] = value, or report that no such index exists. Invariant.
Topic 1: Problem Solving
Algorithms Key Revision Points.
Linear Search Binary Search Tree
Sequential Search slides
Binary Search A binary search algorithm finds the position of a specified value within a sorted array. Binary search is a technique for searching an ordered.
Principles of Computing – UFCFA3-30-1
Topic 24 sorting and searching arrays
Given value and sorted array, find index.
Searching and Sorting Arrays
Searching and Sorting Arrays
CPS120: Introduction to Computer Science
Module 8 – Searching & Sorting Algorithms
CPS120: Introduction to Computer Science
Unit 2: Computational Thinking, Algorithms & Programming
Principles of Computing – UFCFA3-30-1
WJEC GCSE Computer Science
Module 8 – Searching & Sorting Algorithms
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

Activity 1 index = 0 index = index + 1 searchValue = 4 Place these lines of pseudocode to recreate the linear search algorithm. 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 ↑

Activity 4 Show how the value 8 would be found in the list below: 1 2 16 32 64 128 256 ↑

Break After the break we will look at exception handling and debugging.