What is the fastest method to sort two dimensional array? I am creating an application in c++ language and I have a two dimensional string array to store state name and city name. I want to sort that array and display it to list quickly. so, it must be faster.
The declaration will be as follows.
std::string state[STATE_SIZE]
std::string city[STATE_SIZE][CITY_SIZE]
Result Should Look Like This
state[0] = "AAA";
state[1] = "BBB";
city[0][0] = "ABC";
city[0][1] = "PQR";
city[0][2] = "XYZ";
city[1][0] = "ADC";
city[1][1] = "GSF";
city[1][2] = "UHA";
the city array should be sorted by state then city.
I have also read these post. but it just for single dimensional array.
Which is the best Method used for Sorting?
What sort algorithm provides the best worst-case performance?