Introduce memory and efficiency a few months into the AP CS course. Do so in a hands-on way by demonstrating how a computer cannot compute a slow problem.

  • The material covered in the first few months for the AP CS A course compiles so quickly it’s very difficult for students to comprehend why efficiency and memory are important.
  • A great problem to use is the unproven math theorem, predict a perfect number.
    • A perfect number is a number where the sums of factors, not including itself, is equal to the number.
  • Running an inefficient program to uncover perfect number already gets really time com suing after the 5th to 6th!
    • To demonstrate just how slow the program that doesn’t account for memory really is, start a computer that will run the program for a week!
    • Students will be amazed when they see how slowly numbers get output by the program as time goes by.
  • Once students are frustrated and in awe of the program’s slow runtime, ask "Can you make it go faster!?"
    • As a class you can have students look up ways to make the program go faster and try to code solutions in order to outpace the code that has been running all week.

More about this tip

External Source

Interview with Joon Kim

Other Tips By