Jump to page content Jump to navigation

College Board

AP Central

AP Course Audit Web Site
Become an AP Reader
Click for more information about College Board Online Events


Print Page
Home > AP Courses and Exams > Course Home Pages > Teaching Sorting

Teaching Sorting

Read more Strategies...

Contributed by Debbie Carter
Lancaster Country Day School
Lancaster, Pennsylvania


Introduction
Students get into pairs: the Sorter and the Observer. (In a large class, I'd group three students together, including a Tester.) I ask all students to try to analyze and generalize what's happening during each step.

The Sorter is given a stack of random cards and asked (with no specific instructions) to sort them. The Observer watches the process and then writes an algorithm for the process. (This could be done by both together.) The Tester (a member of another group, if working in pairs) tests the algorithm, trying not to insert any "expected" steps. (This technique is similar to, but less messy than, testing a peanut butter sandwich algorithm.) Students refine the algorithm, if needed.

As we're going over the specific sort algorithms and code, I ask students to try to decide which sort uses "their" algorithms. Usually, they've used some variation or hybrid method, but they recognize elements in various sorts ("That's like mine, except it...").

Algorithms and Code
I've used various manipulatives to illustrate the sorts while we're walking through the code:
  • Have students line up (randomly) and then sort them by height, last name, etc. I use masking tape to make the outline of an array on the floor.
  • Stacking cups.
  • Web animations:
    Sandeep Mitra's Java Sorting Animation Page (SUNY Brockport)
      Sandeep Mitra's Java Sorting Animation Page (SUNY Brockport)

    Racing Sorts Page (SUNY Brockport)
    Runs multiple demos at the same time so you can compare them.
      Racing Sorts Page (SUNY Brockport)

    Complete Collection of Algorithm Animations
    Provides links to many other Web sites' animations (collected by Hope College). Note: Some sites require other software to execute the animations.
      Complete Collection of Algorithm Animations (CCAA)

    Java Applets for Data Structures and Algorithms
    Shows animations for sorting, searching, stacks and queues, linked lists, binary trees, plus Towers of Hanoi and N-Queens (R. Mukundan).
      Java Applets For Data Structures and Algorithms

    These animation sites are also good review tools, because students can visit them on their own.
For many students, however, the technique that makes it sink in is one of the simplest and least multimedia-enhanced: draw a simple array of numbers on the white board and follow the code (also on the board), erasing and rewriting the numbers in the appropriate places.


  MY AP CENTRAL
    Course and Email Newsletter Preferences
  AP COURSES AND EXAMS
    Course Home Pages
    Course Descriptions
    The Course Audit
    Sample Syllabi
    Teachers' Resources
    Exam Calendar and Fees
    Exam Questions
    AP Credit Policy Information
  PRE-AP
    Teachers' Corner
    Publications
  AP COMMUNITY
    About Electronic Discussion Groups
    Become an AP Exam Reader

Back to top