Wednesday 15 April 2015

c++ - When do you call stable_sort() on scalars? -


Is it ever scalar to static_source instead of sorting Good to call on type with default comparator (i.e. int , long , etc.)?

If so, when should you do so?

If not, why not do the standard libraries do so in front of sort ? Will not it be much faster?

The static type is really useful only when you are sorting items, CLRS ( Introduction algorithm, 3rd ed. ):

"In practice, the numbers can be sorted rarely have different values. Each usually has a collection of data Is a part called a record. Each record has a key, which is the value to sort. There are satellite data, which is usually the key. In practice, when a sorting algorithm permits the key, it should also be arranged in the form of satellite data. "


When a type is fixed, it means that the relationship broken into an array sorted by the original order of items If you only have int and If you are sorting long types, then you need a steady type of type Security is not.

No comments:

Post a Comment