hi do we have binary sort algorithm ? like merge sort or the other kinds of sorts do we have binary sort?? is there any kind of sorts that its name is binary sort? thanks
There's this and there's binary insertion sort. The two are pretty similar. They're both quadratic (O(n^2)
) time algorithms.
Both algorithms do O(n log n)
number of comparisons, but in practice you would also have to move elements around, which would make the entire algorithm quadratic.
There are some sort's that involve splitting into two peices (merge sort) but I don't beleive that there is a sort called exactly "binary sort".
We do not have a binary sort algorithm, but we do have binary search on a sorted array.
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.