
Keith B. answered 09/20/19
Software Engineer and Math Geek
Your instructor says not to use any other functions, but did say you can use data structures. The question to ask is if you can use the STL? The STL or Standard Template Library is a collection of containers and functions that standardized common operations, such as searches sorting and more.
There is a specific data structure that is ideal for this assignment - it's called a set. Sets are containers that store unique elements, the key word here being unique. Items can be inserted into the set and duplicates just get inserted into the same location. set has operators to check for duplicates, but in this case you don't care. The STL is also highly optimized, so working through the instructors list of 1 million names should still be close to O(n).