[Level 1] Computer Science Concepts: Concept of an Algorithm

What is this Resource?

This document was prepared by Sumant Murugesh, Tim Bell and Vanja Venrooy at the University of Canterbury. It is not an official document, but is offered as an evolving guide to the resources that are available for teaching the new material in NCEA Digital Technologies (currently focussed on the Programming and Computer Science strand). The structure has been based on various versions of the Body of Knowledge, proposed Standards, and Teaching and Learning guide; the material comes from an extensive search for relevant resources. It is our hope that this resource will evolve based on feedback from teachers, and ultimately end up as teaching plans that are built on the resources. Feedback can be sent to tim.bell [at] canterbury.ac.nz.

Achievement Standard
The resources on this page relate mostly to the Digital Technologies Achievement Standard 1.44/AS91074 (Demonstrate understanding of basic concepts from computer science)

Objectives
Demonstrate an understanding of the distinguishing concepts of algorithms and programming languages from Computer Science and Software Engineering

  • Understand what an algorithm is and how it is different from a program
  • Comparing and contrasting algorithms, programs, and informal instructions
  • Describing an algorithm for a task, showing understanding of the way steps can be combined in sequential, conditional, and iterative structures (control flow)
  • Determine the cost of an iterative algorithm on a problem of size n
  • Download programs that implement different algorithms for the same problem, and compare how fast they are. For example, if students are using the Scratch language, there is a zip file of programs available that include several different implementations of searching and sorting algorithms.

Context
The key thing at this level is to be able to compare different algorithms for the same task, such as linear and binary search, and consider how they differ as the amount of data being searched increases. This can be done in a variety of ways without even implementing the algorithms; it could be a simple analysis of the time taken to do an algorithm by hand (such as searching phone books of various sizes), or timing an on-screen animation where the algorithms “race” each other, or an offline activity such as the CSUnplugged “Battleships” game, where the algorithm becomes a strategy for winning a competition.

Ideas for Teaching and Learning Activities

  • Estimate how long it takes to look up a name in the local telephone book using a conventional (binary search) method compared with looking through every page starting at page 1 (linear search). Now consider how the two methods compare if the phone book was 10 times larger, or even a thousand times larger. (Linear search might take days or weeks, whereas binary search doesn't take much longer even for a book with millions of pages.)
  • Give students a pile of 50 cards with numbers on them, and have a competition to see who can sort them the fastest. What are the best strategies?
  • Find the sum of the first n whole numbers (1 + 2 + ... + n), either by hand or using a computer program. Contrast the amount of effort needed (e.g. in terms of arithmetic operations) using the obvious method of n-1 additions, with using a formula for the sum (n*(n+1)/2).
  • Explore the purpose (not the details) of a wide variety of appropriate algorithms, such as search algorithm for sorted lists, sorting algorithms, graph algorithms for finding paths and checking connectedness, maze algorithms, long multiplication (normal and “russian peasant”), and greatest common divisor.
  • Given two lists of the number plates of every car that went down two streets, discuss algorithms to produce a single list of all cars that travelled down both roads. (There are several ways to do this, one of the fastest is to sort the two lists before comparing them; a slow one is to search one list for each item in the other list).

Our Picks
Here is a shortlist of resources we have picked from the comprehensive list below that were either developed for high school use or can be easily adapted for the purpose.

 

Unit Plan
A Unit Plan for teaching that uses some of the above resources that relates to this standard is attached as a PDF at the bottom of this resource page.

Comprehensive list of resources that relate to this standard

The resources below are a mixture that were developed for a varied audience ranging from high school students to university undergraduates, therefore we have attempted to classify the resources in terms of their readiness to be used by teachers. There are those that aim to convey a Basic understanding of the concepts and those that are Advanced and therefore might assist teachers with their professional development activities.


Online Guides: Basic Resources
These set of resources aim at conveying a basic understanding of the concepts with tutorials, lecture notes and handouts.

  • Earl Paine and Stu Schwartz has a resource in the form of a presentation called Binary Searching at the CSTA K-12 Repository introducing sequential and binary searching. Includes walk-throughs of a short sample list, using both algorithms, as well as a discussion of effiency. (language-independent)
  • Cambridge University Press offers a free excerpt from Stan Dolan on Algorithms that covers the following: know what an algorithm is, be able to apply the algorithms known as Bubble Sort, Shuttle Sort and First-Fit, know how to define the size of a problem, and the efficiency and order of an algorithm.
  • Greg Mori has a course Data Structures and Programming (uses Java and C++ implementations) with the following resources:
    Note: These notes discuss a lot more than what is required for high school, but the notes should be very clear and easy to understand for teachers!
    1. Big O Notation: discusses time and space efficiency of algorithms with examples
    2. Binary Search Trees: discusses trees in general with sort algorithms for trees
    3. External Storage: discusses searching through large data sets

 

Online Guides: Advanced Resources
These set of resources aim at conveying an advanced understanding of the concepts with tutorials, lecture notes and handouts. They are generally more suitable for teachers to get a a broader view of the topic than for teaching students.

 


Visual Simulations & Demonstrations: Basic Resources
Here we have compiled a list of visualisation resources that demonstrate the more main stream sort algorithms, and also use simpler graphics to illustrate the concepts.

  • Mr Barton Maths has a great resource called Sorting Algorithms, which is an impressive spreadsheet which covers bubble sort, shuttle sort, and other sorting algorithms. the original list of numbers can be edited to suit your needs.
  • Sorting Algorithm Animation System (SAAS) features a very clear comparison of sort algorithms using animation. This animation can also be downloaded for offline use at any time.

  • Math Site is a good site that explains sort algorithms and also lets you do the sort yourself with instructions on each step of the algorithm. Students can use this site to get guided on sort algorithms step-by-step

  • David Martin's Sorting Algorithms visually demonstrate the concept of some popular algorithms for sorting data.

  • Brian S. Borowski's Sorting Demo is a gallery to demonstrate most sort algorithms with source code supplied. Note: This demo is unique in that the user can input the data to be sorted and watch the animation!
  • Kirk Pruhs from University of Pittsburgh has several applets to demonstrate sorting algorithms below:
    1. Sorting Applet 1  allows the user to enter up to 25 of their own numbers and watch the applet sort the numbers
    2. Sorting Applet 2 This applet uses bar graphics as size indicators and includes a counter for the numbers of moves made and the number of comparisons made
    3. Sorting Applet 3 This applet also uses bars as values and uses a little bit more animation to show the steps involved in performing certian sorts. This applet also has information printed at the bottom to show / explain why objects are being moved as they are. The applet also has several interresting modes to play around with.
  • Kirk Pruh hosts the following applets for sorting demonstrations:
    1. Animation of Sort Algorithms Applet written by Justin Dildy & Sandeep Poonen
    2. Sorting Demo Applet which also allows comparisons of algorithms. Note: run different sort algorithms on the same set of data and click on Compare Algorithms to get the table of results

 

Visual Simulations & Demonstrations: Advanced Resources
These visualisation resources are to demonstrate several other sort algorithms, and some times need setting up, and use complex graphics to illustrate the concepts.

  • Showsort has visualisations of a complete set of algorithms from bubble sort to tree sort. This application presents a graphical representation of sorting an array of integers. In addition to the animated sorting, this app includes a description of each sorting algorithm with the source code.
    Note: This applet is not recommended for Internet Explorer.
  • Jacob Seidelin has Canvas visualisation of algorithms and is another way to visualise sorting algorithms

    Teachers could print these out for different search parameters for different sort algorithms and hang these canvases as posters in the classroom. These could then be used in quizzing the students on specific algorithms or comparing sorts side by side.

 


Classroom Activities and Games: Basic Resources
Here we list mostly activities that demonstrate the concept of an algorithm and how different algorithms work differently. For example, by doing the CS Unplugged's Lighest and Heaviest activity, students can get an understanding of how different sort algorithms work in relation to each other

  • CS Unplugged Activity 7 - Sorting Algorithms examines selection sort, quick sort, insertion sort, bubble sort and merge sort.

  • Brian S. Borowski's Guessing Game could be used to illustrate the concept of Binary Search.
  • Cre8ate Maths UK has a resource called Ferries that allows pupils to develop their own strategies and to consider the idea of an ‘efficient’ algorithm. The activity explores First Fit and Full Bins algorithms and lets students compare the effectiveness of these algorithms.
    Note: You will need to register (free) as a teacher at Cre8ate Maths UK to access this resource
  • CS4FN has the following online activities/articles that demonstrates concepts in algorithms and complexity:
    1. Swap Puzzle (Interactive Activity): Algorithms is also about devising efficient ways of doing things. Two different ways of doing something could both guarantee to get the job done but one may be quicker than the other and so better.
    2. Bean Counting
    3. Non-reversing Mirror
    4. The cure that just folds away
  • CS4FN has an activity related to the French Peasant's Multiplication called the The French Peasant's Lock and Gray Code. The solution to the lock is actually something know to Computer Scientists as Gray Code : a code used in modern digital TV. Whatever, their physical form all the variations of the lock puzzle have the same solution and are logically (and so their solutions algorithmically) identical. Solve one and you've solved them all (Computer Scientist's love pulling that trick with problems!)
  • Frank Baker has a card sorting activity, that gets students to think about the problem of sorting some playing cards.  The rules of the "game" essentially abstract the "rules" for the comparison-based sorting in a computer. It seems to work well to get kids into the CS mindset, and builds some confidence that they can succeed. It has the nice side effect of teaching the O(n^2) sorting algorithms and a little big-oh analysis (if you choose to do so) all on the first day!

 

Classroom Activities and Games:  Advanced Resources
These resources are not neccessarily aimed at a higher level of students, they sometimes require more preparation and in some cases more pupils in the classroom. For example, Steve Wolfman's Couting the Class activity requires 50 students as a guideline and may need customising to your own class needs.

  • Steve Wolfman has a KLA activity Counting the Class for students to invent and analyze for counting the number of people in the class and implement at least one on the spot. After the exercise, students will understand that many different algorithms may address a single problem. They will recognize that there may be tradeoffs between speed, accuracy, and accuracy guarantees (such as upper and lower bounds).

 


Videos: Basic Resources
These videos help to re-inforce the concepts of algorithms.

  • A fun video to watch is where a 19 month old girl tries to sort out her toy boxes in order of the next largest one at The Maggie Sort Algorithm
  • Watch a Schoolhouse Rock-style YouTube video that teaches the difference between two sorting algorithms---selection sort and quick sort. Created for use in an introductory computer science class at Rutgers University (NJ, USA)

  • O2 Learn has the following tutorial video explaining The Quick Sort Algorithm

  • Knight School 2009 at Menlo School has a video on Algorithmic Thinking on YouTube that illustrates how several simple sorting algorithms operate, using people as the objects to be sorted at Sorting Algorithms. Please see the notes attached below the video for further explanation of each sort algorithm used here.
  • Royce Neagle has videos on the two following related topics below (these are more suitable beyond level 1):

    1. Hill Climbing: Using searching to solve problems with many solutions, some of which are better than others.
    2. Optimisation: Techniques used to solve very hard problems with no quick and easy answer.

 

Videos: Advanced Resources
These videos are from lectures offered at undergraduate level in CS and therefore can be used for reference and further study by teachers.

  • Grady Booch in this thought-provoking presentation (delivered at the 2007 SIGCSE Technical Symposium) explores the beauty and the complexity of software development and raises key questions about the limits of what we know, what we can do, and what we should do. He also explores the history of software development and what the future might hold. Teachers can use this presentation to inform their own knowledge or classroom practices and share it with students to provoke interesting discussions about our history and our future.

    Download presentation.
    Download videos at Data and Halo.

 

AttachmentSize
Computer Science Concepts AS 1.44 Unit Outline - 09.08.10.pdf275.44 KB