Today at school the teacher asked us to implement a duplicate-deletion algorithm. It\'s not that difficult, and everyone came up with the following solution (pseudocode):
You can often use a space-time tradeoff and invest more space to reduce time.
In this case you could use a hash table to determine the unique words.