Fastest sort algorithm?

Hey guys, I am making a spell checker. I have to load the dictionary text file into a vector (which I have done), sort the vector into alphabetical order to make searching easy, and then spell check another text file against it and use binary search to find the word in the dictionary. I have everything done except the sorting algorithm. I am currently using STL sort just to test everything else but I have to write a sort function myself. The dictionary is around half a million words and is mostly sorted. Thanks!
Last edited on
I'm a bit confused and dumbfounded about what you specifically want help with. Can you give more detail on what exactly it is that you want? What is the specific algorithm that you need help with? ect?
Last edited on
Haha, sorry I may have made it seem more complicated than it is. Basically, I need to know the most efficient way to sort half a million strings in a vector if it is almost sorted already. I don't have to use any specific code but I have to write it myself (can't use STL sort).
You could use Quick Sort. Insertion Sort is much faster if the elements are nearly sorted but it's terrible slow if the elements are randomly ordered so using Quick Sort is a much safer choice.
The elements are nearly sorted. What about shell sort? I think that would be good but I've never worked with it so I'm not sure if I'll be able to use it until I learn it.
Topic archived. No new replies allowed.