Does a “binary sort” algorithm exist?

前端 未结 8 1158
孤独总比滥情好
孤独总比滥情好 2021-01-07 21:59

Is there a sorting algorithm that is named \"binary sort\"? Like merge sort, selection sort, or the other kinds of sorting, does a binary sort exist?

8条回答
  •  有刺的猬
    2021-01-07 22:48

    Not sure what your looking for but if your looking for a suitable binary sort algorithm then you want to be aware of your requirements. Each algorithm has its own strengths and weakness.

    For example, are you looking for an algorithm that give fastest average performance (e.g. heap search) or fasted worst case (slowest operation) performance (e.g. balanced binary tree). Some are slow if you also need to iterate from one item to the next. If your doing many random operations you are probably more interested in average performance but if you have a need to ensure that any operation is faster than X milliseconds then you may want a different algorithm. Some can be slow if you always adding items at the end of the collection etc.

    So have a google for keywords like:

    • Red black tree
    • heap search
    • balanced trees, e.g. http://www.codeproject.com/KB/recipes/redblackcs.aspx?msg=931557

    It all comes down to what you need.

提交回复
热议问题