Answer the question
In order to leave comments, you need to log in
What sorting algorithm to use to sort by price?
Sorting for search results by real estate listings database (date and price). In any case, the result will be ordered sections (since the prices are approximately equal and the date is also already normal). What algorithm to use?
Answer the question
In order to leave comments, you need to log in
The distribution in the sample is not random and predictable. They use it. You can first decompose into baskets (basket sort) or price order (radix sort). This will give a significant performance boost, if that's what you are interested in (up to linear n, against christomath n*log(n)). If you sort by date, then the selection will be partially ordered (and by the price you wrote) - on partially ordered arrays, simple insertion sort is the most effective. However, the newfangled TimSort built into Python and Java stdlib tries to use both optimizations.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question