Teaching Computing to GCSE

Slides:



Advertisements
Similar presentations
Bubble Sort Algorithm 1.Initialize the size of the list to be sorted to be the actual size of the list. 2.Loop through the list until no element needs.
Advertisements

Sorting A fundamental operation in computer science (many programs need to sort as an intermediate step). Many sorting algorithms have been developed Choose.
 Sort: arrange values into an order  Alphabetical  Ascending numeric  Descending numeric  Does come before or after “%”?  Two algorithms considered.
Computer Programming Sorting and Sorting Algorithms 1.
Algorithms for Sorting Things. Why do we need to sort things? Internal Telephone Directory –sorted by department then by name My local video store holds.
Searching and Sorting Arrays
Name(s): _______________________ Sorting Cards Directions: 1.Gather your set of food cards and color cards and split them into a “food” pile and a “color”
Selection Sort Given n numbers to sort: Repeat the following n-1 times:  Mark the first unsorted number  Find the smallest unsorted.
Lecture 5 Sorting. Overview Mathematical Definition.
Fall 2013 Instructor: Reza Entezari-Maleki Sharif University of Technology 1 Fundamentals of Programming Session 17 These.
Lesson 2. Starter Look at the hand out you have been given. Can you sort the numbers into ascending order. What mental or physical methods did you use.
CHAPTER 09 Compiled by: Dr. Mohammad Omar Alhawarat Sorting & Searching.
Objectives - 11  We will work with processing Arrays.  Objectives:  Describe the concept of an array and its benefits.  Define the terms index, traverse,
Data Structures: A Pseudocode Approach with C, Second Edition1 Chapter 12 Objectives Upon completion you will be able to: Understand the basic concepts.
© 2006 Pearson Addison-Wesley. All rights reserved10 B-1 Chapter 10 (continued) Algorithm Efficiency and Sorting.
Chapter 12 Binary Search and QuickSort Fundamentals of Java.
Decision Maths 1 Sorting Algorithm Shuttle Sort A V Ali : 1.Compare items 1 and 2; swap them if necessary 2.Compare 2 and 3; swap.
New Mexico Computer Science For All Sorting Algorithms Maureen Psaila-Dombrowski.
Chapter 8 Sorting and Searching Goals: 1.Java implementation of sorting algorithms 2.Selection and Insertion Sorts 3.Recursive Sorts: Mergesort and Quicksort.
Sorting. Sorting Sorting is important! Things that would be much more difficult without sorting: –finding a telephone number –looking up a word in the.
Can you put these children’s TV shows in date order - earliest to latest?
OCR A Level F453: Data structures and data manipulation Data structures and data manipulation a. explain how static data structures may be.
Starter Complete the Word Search. CG3.7 Algorithms (The Insertion Sort (Chapter 46) & Algorithm Testing)
CMSC 104, Version 8/061L24Searching&Sorting.ppt Searching and Sorting Topics Sequential Search on an Unordered File Sequential Search on an Ordered File.
Sort Algorithm.
3.3 Fundamentals of data representation
Sorting Dr. Yingwu Zhu.
Alternate Version of STARTING OUT WITH C++ 4th Edition
Searching and Sorting Algorithms
Fundamentals of Java: AP Computer Science Essentials, 4th Edition
Lecture 14 Searching and Sorting Richard Gesick.
IGCSE 6 Cambridge Effectiveness of algorithms Computer Science
Algorithm Efficiency and Sorting
Sorting Algorithms.
Teaching Computing to GCSE
Sorting Data are arranged according to their values.
Insertion Sort Sorted Unsorted
Bubble Sort Bubble sort is one way to sort an array of numbers. Adjacent values are swapped until the array is completely sorted. This algorithm gets its.
Algorithm Efficiency and Sorting
Bubble Sort The basics of a popular sorting algorithm.
Selection Sort Sorted Unsorted Swap
Teaching Computing to GCSE
Teaching Computing to GCSE
Searching and Sorting Topics Sequential Search on an Unordered File
Shuttle Sort Example 1st pass Comparisons: 1
And now for something completely different . . .
Searching and Sorting Topics Sequential Search on an Unordered File
MSIS 655 Advanced Business Applications Programming
Teaching Computing to GCSE
Sorting Data are arranged according to their values.
Lecture 11 Searching and Sorting Richard Gesick.
Teaching Computing to GCSE
MSIS 655 Advanced Business Applications Programming
IT 4043 Data Structures and Algorithms
UMBC CMSC 104 – Section 01, Fall 2016
Searching and Sorting Topics Sequential Search on an Unordered File
Algorithms Key Revision Points.
Sorting Dr. Yingwu Zhu.
Visit for More Learning Resources
COMPUTER 2430 Object Oriented Programming and Data Structures I
Decision Maths Unit 7 Sorting Algorithms 3. Shell Sort.
Sorting Chapter 10.
Algorithm Efficiency and Sorting
Algorithms Sorting.
Unit 2: Computational Thinking, Algorithms & Programming
Chapter 19 Searching, Sorting and Big O
Shuttle Sort Example 1st pass Comparisons: 1
WJEC GCSE Computer Science
Algorithm Efficiency and Sorting
Visit for more Learning Resources
Presentation transcript:

Teaching Computing to GCSE Session 7 Theory: Sorting Algorithms Practical: Testing

Specification Content OCR Standard sorting algorithms: Bubble sort Merge sort Insertion sort AQA Understand and explain how the merge sort algorithm works. Understand and explain how the bubble sort algorithm works. Compare and contrast merge sort and bubble sort algorithms. Edexcel Understand how standard algorithms (bubble sort, merge sort) work.

Sorting Algorithms We use sorting algorithms to sort lists of unordered values. There are many different sorting algorithms, these include: Bubble Sort Merge Sort Insertion Sort

Activity 1 This activity will demonstrate a fun way of teaching sorting algorithms.

Bubble Sort Tracing (1) In exams students may be asked to demonstrate their understanding of the bubble sort algorithm by tracing it. One method of tracing is to show the state of the list after each swap. Original List 2 3 1 5 6 4 Swap 1 Swap 2 Swap 3 Swap 4

Bubble Sort Tracing (2) Another way to trace the bubble sort algorithm is to show the state of the list after each complete pass. Original List 2 3 1 5 6 4 Pass 1 Pass 2 Pass 3

Activity 2a Complete this table to show the state of the list after each swap using the bubble sort algorithm: Original List 56 32 49 24 Swap 1 Swap 2 Swap 3 Swap 4 Swap 5

Activity 2b Complete this table to show the state of the list after each pass using the bubble sort algorithm: Original List 78 46 13 27 Pass 1 Pass 2 Pass 3

Merge Sort Tracing In exams students may be asked to demonstrate their understanding of the merge sort algorithm by tracing it. Original List 3 2 7 5 1 8 6 4 Stage 1 Stage 2 Stage 3 Stage 4

Activity 3 Complete this table to show the state of the list after each stage of the merge sort algorithm: Original List 56 44 76 21 14 82 65 71 Stage 1 Stage 2 Stage 3 Stage 4

Insertion Sort Tracing In exams students may be asked to demonstrate their understanding of the insertion sort algorithm by tracing it. Sorted Unsorted Stage 1 23, 56, 87, 18, 29 Stage 2 23 56, 87, 18, 29 Stage 3 23, 56 87, 18, 29 Stage 4 23, 56, 87 18, 29 Stage 5 18, 23, 56, 87 29 Stage 6 18, 23, 29, 56, 87

Activity 4 Complete this table to show the state of the list (56, 44, 76, 21, 14) after each stage of the insertion sort algorithm: Sorted Unsorted Stage 1 Stage 2 Stage 3 Stage 4 Stage 5 Stage 6

Comparison Students need to understand the benefits and drawbacks of each sorting algorithm. Algorithm Benefits / Drawbacks Bubble Sort Simple to implement but very inefficient. Merge Sort An efficient algorithm for sorting both large and small lists. Insertion Sort Relatively efficient when used with small lists, but not with larger lists.