Funnelsort
Funnelsort is a comparison-based sorting algorithm.[src] It is similar to mergesort, but it is a cache-oblivious algorithm, designed for a setting where the number of elements to sort is too large to fit in a cache where operations are done.[src] It was introduced by Matteo Frigo, Charles Leiserson, Harald Prokop, and Sridhar Ramachandran in 1999 in the context of the cache oblivious model.[src]
Funnelsort is a comparison-based sorting algorithm.[src] It is similar to mergesort, but it is a cache-oblivious algorithm, designed for a setting where the number of elements to sort is too large to fit in a cache where operations are done.[src] It was introduced by Matteo Frigo, Charles Leiserson, Harald Prokop, and Sridhar Ramachandran in 1999 in the context of the cache oblivious model.[src] In the external memory model, the number of memory transfers it needs to perform a sort of N items on a machine with cache of size Z and cache lines of length L is O \left(\tfrac{N}{L} \log_{Z} N \right) , under the tall cache assumption that Z = \Omega(L^2) .[src] This number of memory transfers has been shown to be asymptotically optimal for comparison sorts.[src] Funnelsort also achieves the asymptotically optimal runtime complexity of \Theta(N \log N) .[src] The first important bound is that a k-merger can be fit in O(k^2) space.[src] To see this, we let S(k) denote the space needed for a k-merger.[src] To fit the k^{1/2} buffers of size 2k^{3/2} takes O(k^2) space.[src] To fit the \sqrt{k} + 1 smaller buffers takes (\sqrt{k} + 1) S(\sqrt{k}) space.[src] Thus, the space satisfies the recurrence S(k) = (\sqrt{k} + 1) S(\sqrt{k}) + O(k^2) .[src] This recurrence has solution S(k) = O(k^2) .[src] It follows that there is a positive constant \alpha such that a problem of size at most \alpha \sqrt{Z} fits entirely in cache, meaning that it incurs no additional cache misses.[src] Letting Q_M(k) denote the number of cache misses incurred by a call to a k-merger, one can show that Q_M(k) = O((k^3 \log_Z k)/L).[src] This is done by an induction argument.[src] It has k \le \alpha \sqrt{Z} as a base case.[src] For larger k, we can bound the number of times a \sqrt{k} -merger is called.[src] The output merger is called exactly k^{3/2} times.[src] The total number of calls on input mergers is at most k^{3/2} + 2\sqrt{k} .[src] This gives a total bound of 2 k^{3/2} + 2 \sqrt{k} recursive calls.[src] In addition, the algorithm checks every buffer to see if needs to be filled.[src] This is done on \sqrt{k} buffers every step for k^{3/2} steps, leading to a max of k^2 cache misses for all the checks.[src] This leads to the recurrence Q_M(k) \le (2k^{3/2} + 2 \sqrt{k}) Q_M(\sqrt{k}) + k^2 , which can be shown to have the solution given above.[src] Finally, the total cache misses Q(N) for the entire sort can be analyzed.[src] It satisfies the recurrence Q(N) = N^{1/3} Q(N^{2/3}) + Q_M(N^{1/3}).[src] This can be shown to have solution Q(N) = O((N/L) \log_Z N).[src]
29 sentences · 29 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Funnelsort." encyclopegia.org, 2026, https://encyclopegia.org/wiki/funnelsort. Accessed 28 November 2026.
Chicago
"Funnelsort." encyclopegia.org. Accessed November 28, 2026. https://encyclopegia.org/wiki/funnelsort.
APA
encyclopegia.org. (2026). Funnelsort. Retrieved November 28, 2026, from https://encyclopegia.org/wiki/funnelsort
Accessed November 28, 2026 · CC BY-SA 4.0 · citation page · JSON