Give students a large data file to sort when teaching sorting algorithms to remind students that computers are great at dealing with a large set of data.

  • Provide students with a file that is missing lines for students to fill in in the implementation of the sorting algorithm.
    • The program should execute when you give it to the students, but give an incorrect output.
    • For this first step, students should be working with a small set of data.
  • After students have a working solution with the small set of data, give them a large set of numbers (maybe 10,000) to sort through.
    • Tell them their solution must be identical to yours to be correct.
    • Use a web resource to get thousands of random numbers. (e.g. www.random.org/integers/)
      • This helped avoid having students hard code the solution.
  • Below we have solution code for implementing sorting algorithms. Remove some of the implementation and then provide this code to your students.
  • The sorting algorithms used in this assignment are:
    • insertionSort, selectionSort

More about this tip

External Source

Interview with Brandon R. Rodriguez