I have to insert a string inside an already sorted list of strings, what is the best way to achieve this to find the exact position to insert without having to sort all the list and not adding the string upfront. I just need to find the position to insert.
I do have a function which Compares 2 strings compare(first-string ,second-string) this function gives me true if first string has to be placed ahead of second string false in other way around. It is expected to use this function.
The List used in my scenario is not a c++ std::list but a customized class which handles some functions of a list.
If you arrived at a parking place where each spot was named with a letter of the alphabet in order from A to Z.
And then I tell you that you can park at letter P.
How would you find that spot ?