Sometimes students get hung up on the difference between substring and subsequence. But the works of Edgar Rice Burroughs have given me an idea for an exercise that might just be silly enough to permanently edge itself into students’ memory.
Enter John Carter, Jeddak of Jeddaks, Warlord of Mars, depicted here with his wife, Dejah Thoris, Princess of Helium, daughter of Mors Kajak, who is Jed of Helium and son to Tardos Mors, Jeddak of Helium.
And here we have two of John Carter’s most loyal friends. First, Tars Tarkas, Jeddak of Thark.
And next Kantos Kan, Jedwar of the Heliumetic navy.
Kantos Kan has the rare distinction of having a last name that is a substring of the first name. After all, Kantos = Kan + tos.
That’s not the case for Tars Tarkas. While the first name and last name share a common prefix Tar, there is no string that we can put before or after one of those strings to get the other one. But Tars is a subsequence of Tarkas, as the latter is Tar + ka + s. We can build Tarkas from Tars by splicing in additional material.
So remember, substrings are Kantos Kan strings, and subsequences are Tars Tarkas sequences. Okay, your turn. For each one of the following pairs, say whether one is
- a Kantos Kan string of the other,
- a Tars Tarkas sequence of the other,
- Jed and Jeddak
- Tars and Thark
- Jeddak and Jedwar
- Thoris and Tardos Mors
- Tars and Tardos Mors
- Dejah Thoris and Dor
Bonus exercise: Explain why I didn’t allow a fourth option “both” in the exercise.
Bonus bonus exercise: Design similar exercises for other entries from Appendix N.