Create a word counter assignment to help students understand the importance of Big-O.

  • If students have already implemented their own data structure, like a linked list, this is a great assignment to have them utilize it.
  • Have students use an iterator for their search to determine if the word has already appeared in the database. This search becomes O(n^2) as opposed to O(n) if their iterator is implemented improperly.
  • Have programs count the words in the Gettysburg Address to verify their program is working.
  • Next, have programs count the words in War and Peace by Tolstoy.
    • If they use the wrong iterator, this next step can take 4 hours or more!
  • This gets right to the heart of why complexity is such a big issue and such an important part of any problem!

More about this tip

External Source

Interview with Walt Schilling