Oh, wow. I'd estimate that you could have left that thing running for a decade without finishing.
|
Yea. My estimate was just under 25 years.
The way you're thinking it, that alone will take you two and a quarter trillion steps (worst case). If you're going to disallow duplicates, perhaps you should use an std::set, which also automatically sorts its elements. |
Here are the steps that I am thinking:
While there are still lines from the input file to read
{
Read a line (word) from the input
Check an output file to see if the word is already in the output file (i.e. read the output file)
If the word is not already in the output file then add the word to the output file
}
The equation for the maximum number of steps is probably:
((1/2)*n*(n+1))+2n+1
Since there are about 2,140,000 lines of input then this alone should take 2,289,805,350,000 steps if there are really 2.14 million different words.
I think that there are only about 70,000 different words, so it is probably more like 74,904,315,000 steps.