Copyright © 2004 Elsevier B.V. All rights reserved.
Fun-Sort—or the chaos of unordered binary search
Received 30 April 2002;
References and further reading may be available for this article. To view references and further reading you must purchase this article.
Abstract
Usually, binary search only makes sense in sorted arrays. We show that insertion sort based on repeated “binary searches” in an initially unsorted array also sorts n elements in time Θ(n2 log n). If n is a power of two, then the expected termination point of a binary search in a random permutation of n elements is exactly the cell where the element should be if the array was sorted. We further show that we can sort in expected time Θ(n2 log n) by always picking two random cells and swapping their contents if they are not ordered correctly.
Author Keywords: Oblivious sorting; Insertion-sort; Binary search







E-mail Article
Add to my Quick Links

Cited By in Scopus (3)

) can achieve substantial search speedup. We analyze search costs in the conventional and modified trees. Our analysis shows that two-way comparison need only be slightly faster than three-way comparison for the modified tree algorithm to be superior. Moreover, search costs for the modified tree fit the alphabetic code tree model, so that an optimal tree for the modified algorithm can be constructed in O(



