## Optimal incremental sorting (2006)

### Cached

### Download Links

Venue: | In Proc. 8th Workshop on Algorithm Engineering and Experiments (ALENEX |

Citations: | 7 - 5 self |

### BibTeX

@INPROCEEDINGS{Paredes06optimalincremental,

author = {Rodrigo Paredes and Gonzalo Navarro},

title = {Optimal incremental sorting},

booktitle = {In Proc. 8th Workshop on Algorithm Engineering and Experiments (ALENEX},

year = {2006},

pages = {171--182},

publisher = {SIAM Press}

}

### OpenURL

### Abstract

Let A be a set of size m. Obtaining the first k ≤ m elements of A in ascending order can be done in optimal O(m+k log k) time. We present an algorithm (online on k) which incrementally gives the next smallest element of the set, so that the first k elements are obtained in optimal time for any k. We also give a practical algorithm with the same complexity on average, which improves in practice the existing online algorithm. As a direct application, we use our technique to implement Kruskal’s Minimum Spanning Tree algorithm, where our solution is competitive with the best current implementations. We finally show that our technique can be applied to several other problems, such as obtaining an interval of the sorted sequence and implementing heaps. 1

### Citations

8523 |
Introduction to Algorithms
- Cormen, Leiserson, et al.
- 2001
(Show Context)
Citation Context ..., respectively. We call Kruskal1 and Prim1 these basic versions. In sparse graphs, with |E| = O(n), it is recommended to use Kruskal1, whereas in dense graphs, with |E| = O(n2 ), Prim1 is recommended =-=[4, 21]-=-. There are other MST algorithms compiled by Tarjan [20]. Recently, Chazelle [3] gave an O(mα(m, n)) algorithm, where α ∈ ω(1) is the very slowly-growing inverse Ackermann’s function. Later, Pettie an... |

2362 | Modern Information Retrieval
- Baeza-Yates, Ribeiro-Neto
- 1999
(Show Context)
Citation Context ...allest elements from a fixed set without knowing how many elements we will end up needing. Prominent examples are Kruskal’s Minimum Spanning Tree (MST) algorithm [14] or ranking by Web search engines =-=[1]-=-. Given a graph, Kruskal’s MST algorithm processes the edges one by one, from smaller to larger, until forming the MST. At this point, remaining edges are not considered. On the other hand, Web search... |

1681 |
Core Team R : A Language and Environment for Statistical Computing. R Foundation for Statistical Computing
- Development
(Show Context)
Citation Context ...rnatives. In the second we evaluate our Kruskal3 algorithm. The experiments were run on an Intel Xeon of 3.06 GHz, 2 GB of RAM and local disk. The weighted least square fittings were performed with R =-=[19]-=-. In order to illustrate the precision of our fittings, we also show the average percent error of residuals with respect to real values (| y−ˆy y |100%) for fittings belonging to the 44% of the larges... |

604 |
Data Structures and Network Algorithms
- Tarjan
(Show Context)
Citation Context ...ions. In sparse graphs, with |E| = O(n), it is recommended to use Kruskal1, whereas in dense graphs, with |E| = O(n2 ), Prim1 is recommended [4, 21]. There are other MST algorithms compiled by Tarjan =-=[20]-=-. Recently, Chazelle [3] gave an O(mα(m, n)) algorithm, where α ∈ ω(1) is the very slowly-growing inverse Ackermann’s function. Later, Pettie and Ramachandran [17] proposed an algorithm that runs in o... |

575 |
Fibonacci heaps and their uses in improved network optimization algorithms
- Fredman, Tarjan
- 1987
(Show Context)
Citation Context ... concluding that the best MST version is Prim’s using paring heaps [6], we call Prim2 this algorithm. Their experiments show that neither Cheriton and Tarjan’s [20] nor Fredman and Tarjan’s algorithm =-=[7]-=- ever approach the speed of Prim2. On the other hand, they show that Kruskal1 can run very quickly when it uses an array of edges that can be overwritten during sorting, instead of an adjacency list. ... |

531 |
Shortest connection networks and some generalizations
- Prim
- 1957
(Show Context)
Citation Context ...ementation, whichis much faster than any other Kruskal’s implementation we could program or find for any graph density. As a matter of fact, our Kruskal’s version is faster than the Prim’s algorithm =-=[18]-=-, even as optimized by Moret and Shapiro [16], and also competitive against the best alternative implementations we could find [12, 13]. We finally show that our algorithm can be used to solve other b... |

436 |
On the Shortest Spanning Subtree of a Graph and the Travelling Salesman Problem
- Kruskal
- 1956
(Show Context)
Citation Context ...e cases where we need to obtain the smallest elements from a fixed set without knowing how many elements we will end up needing. Prominent examples are Kruskal’s Minimum Spanning Tree (MST) algorithm =-=[14]-=- or ranking by Web search engines [1]. Given a graph, Kruskal’s MST algorithm processes the edges one by one, from smaller to larger, until forming the MST. At this point, remaining edges are not cons... |

368 | Time bounds for selection
- Blum, Pratt, et al.
- 1972
(Show Context)
Citation Context ...rs and integer k ≤ m, output the smallest k elements of A in ascending order. Partial Sorting can be easily solved by first finding p, the k-th smallest element of A, using O(m) time Select algorithm =-=[2]-=-, and then collecting and sorting the elements smaller than p. We call SelectSort this algorithm. Its complexity, O(m + k log k), is optimal under the comparison model, as there are m k = m!/(m − k)! ... |

148 |
Algorithm 232: Heapsort
- Williams
- 1964
(Show Context)
Citation Context ...1)-th, the (k + 2)-th and (k − 2)-th, and so on. The second remark is we can use IQS as an underlying implementation of the Heap data structure [4, 21]. (Naturally, this allow us to speed up HeapSort =-=[22]-=-.) In this application, we heapify the set A by using IQS to search for the first element, paying on average O(m) CPU time, and then we extract elements by using IQS incrementally, paying average amor... |

115 | A randomized linear-time algorithm to find minimum spanning trees
- Karger, Tarjan, et al.
- 1995
(Show Context)
Citation Context ... algorithm is also O(mα(m, n)). These algorithms almost reach the lower bound Ω(m), yet they are so complicated that their interest is mainly theoretical. Furthermore, there is a randomized algorithm =-=[13]-=- that finds the MST in O(m) time with high probability in the restricted RAM model, but it is also considered impractical as it is complicated to implement and the O(m) complexity hides a big constant... |

74 |
A minimum spanning tree algorithm with inverse-Ackermann type complexity
- Chazelle
- 2000
(Show Context)
Citation Context ...ith |E| = O(n), it is recommended to use Kruskal1, whereas in dense graphs, with |E| = O(n2 ), Prim1 is recommended [4, 21]. There are other MST algorithms compiled by Tarjan [20]. Recently, Chazelle =-=[3]-=- gave an O(mα(m, n)) algorithm, where α ∈ ω(1) is the very slowly-growing inverse Ackermann’s function. Later, Pettie and Ramachandran [17] proposed an algorithm that runs in optimal time O(T ∗ (m, n)... |

54 |
Data Structures and Algorithm Analysis in Java
- Weiss
- 1999
(Show Context)
Citation Context ..., respectively. We call Kruskal1 and Prim1 these basic versions. In sparse graphs, with |E| = O(n), it is recommended to use Kruskal1, whereas in dense graphs, with |E| = O(n2 ), Prim1 is recommended =-=[4, 21]-=-. There are other MST algorithms compiled by Tarjan [20]. Recently, Chazelle [3] gave an O(mα(m, n)) algorithm, where α ∈ ω(1) is the very slowly-growing inverse Ackermann’s function. Later, Pettie an... |

48 |
The pairing heap: A new form of self-adjusting heap
- Fredman, Sedgewick, et al.
- 1986
(Show Context)
Citation Context ...etical. Experimental studies on MST are given in [16, 12, 13]. In [16], they compare several Kruskal’s, Prim’s and Tarjan’s versions, concluding that the best MST version is Prim’s using paring heaps =-=[6]-=-, we call Prim2 this algorithm. Their experiments show that neither Cheriton and Tarjan’s [20] nor Fredman and Tarjan’s algorithm [7] ever approach the speed of Prim2. On the other hand, they show tha... |

46 | An optimal minimum spanning tree algorithm
- Pettie, Ramachandran
(Show Context)
Citation Context ...er MST algorithms compiled by Tarjan [20]. Recently, Chazelle [3] gave an O(mα(m, n)) algorithm, where α ∈ ω(1) is the very slowly-growing inverse Ackermann’s function. Later, Pettie and Ramachandran =-=[17]-=- proposed an algorithm that runs in optimal time O(T ∗ (m, n)), where T ∗ (m, n) is the minimum number of edge-weight comparisons needed to determine the MST of any graph G(V, E) with m edges and n ve... |

45 | Fast priority queues for cached memory
- Sanders
- 1999
(Show Context)
Citation Context ... only if k = o(m c ) for any c > 0, and then m dominates k log m. However, according to experiments this scheme is much slower than the offline practical algorithm PQS if a classical heap is used. In =-=[22]-=-, P. Sanders proposes sequence heaps, a cacheaware priority queue to solve the online problem, which is optimized to insert and extract all the elements in the priority queue at small amortized cost. ... |

35 |
Algorithm 65: Find
- Hoare
- 1961
(Show Context)
Citation Context ...og k), is optimal under the comparison model, as there are m k = m!/(m − k)! possible answers and log(m k ) = Ω(m + k log k). A practical version of the above, QuickSelectSort (QSS), uses QuickSelect =-=[9]-=- and QuickSort [10] as the selection and sorting algorithms, obtaining O(m+k log k) average complexity. Recently, it has been shown that selection and sorting can be interleaved. The result, PartialQu... |

31 | The birth of the giant component
- Janson, Knuth, et al.
- 1993
(Show Context)
Citation Context ...ing graphs whose cost edges are assigned at random independently of the rest (using any continuous distribution), the subgraph composed by V with the edges reviewed by the algorithm is a random graph =-=[11]-=-. Therefore, based on [11], we expect to finish the MST construction upon reviewing 1 2n lnn edges, which can be much lower than m. So, it is not necessary to sort the whole set E, but it is enough wi... |

26 |
a new variant of heapsort beating, on an average, quicksort (if n is not very small
- Bottom-up-heapsort
- 1993
(Show Context)
Citation Context ... and QSS. We measure CPU time and the number of key comparisons, except for SH where we only measure CPU time. As it turned out to be more efficient, we implement HEx by using the bottom up heuristic =-=[24]-=- for extractMin: when the minimum is extracted, we lift up ele2 Our fittings are too pessimistic for small permutations or edge sets, so we intend to show that they are asymptotically good. In the fir... |

20 | An empirical analysis of algorithms for constructing a minimum spanning tree
- Moret, Shapiro
- 1991
(Show Context)
Citation Context ...er Kruskal’s implementation we could program or find for any graph density. As a matter of fact, our Kruskal’s version is faster than the Prim’s algorithm [18], even as optimized by Moret and Shapiro =-=[16]-=-, and also competitive against the best alternative implementations we could find [12, 13]. We finally show that our algorithm can be used to solve other basic problems, such as obtaining an increment... |

16 |
Handbook of Algorithms and Data structures. Addison-Wesley
- Gonnet
- 1984
(Show Context)
Citation Context ...6) p=0 = m − 1 + 1 m ( k−1 ∑ T(p, p) p=0 k−2 ∑ m−1 ∑ + T(m − 1 − p, k − p − 1) + T(p, k) p=0 p=k Eq. (4.6) simplifies to Eq. (4.7) by noticing that T(p, p) behaves exactly like QuickSort, 2(p+1)Hp−4p =-=[8]-=- (this can also be seen by writing down T(p) = T(p, p) and noting that the very same QuickSort recurrence is obtained), so that ∑k−1 p=0 T(p, p) = k(k +1)Hk − k 2 (5k − 1). We also write p ′ for k −p−... |

12 |
Algorithm 245 (TREESORT
- Floyd
- 1964
(Show Context)
Citation Context ... some unknown value k ∈ [0, m − 1]. One can do this by using Select to find each of the first k elements, which costs O(km) overall. We can improve this by transforming A into a min-heap in time O(m) =-=[5]-=-, and then performing k extractions. This costs O(m + k log m) worst-case complexity. Note that m + k log m = O(m + k log k), as they can differ only if k = o(m α ) for any α > 0, and then m dominates... |

10 | A Practical Minimum Spanning Tree Algorithm Using the Cycle Property
- Katriel, Sanders, et al.
- 2003
(Show Context)
Citation Context ...r of fact, our Kruskal’s version is faster than the Prim’s algorithm [18], even as optimized by Moret and Shapiro [16], and also competitive against the best alternative implementations we could find =-=[12, 13]-=-. We finally show that our algorithm can be used to solve other basic problems, such as obtaining an incremental segment of the sorted sequence A, and implementing a heap data structure. The algorithm... |

7 | Partial quicksort
- Martinez
- 2004
(Show Context)
Citation Context ...+k log k) average complexity. Recently, it has been shown that selection and sorting can be interleaved. The result, PartialQuickSort (PQS), has the same average complexity but smaller constant terms =-=[15]-=-. To solve the online problem, we must select the smallest element, then the second one, and so on until the process finishes at some unknown value k ∈ [0, m − 1]. One can do this by using Select to f... |

2 |
Algorithm 410 (partial sorting
- Chambers
- 1971
(Show Context)
Citation Context ...Partial Sorting problem: Given a set A of m numbers and an integer k ≤ m, output the smallest k elements of A in ascending order. In 1971, J. Chambers introduced the general notion of Partial Sorting =-=[3]-=-: given an array A of m numbers, and a fixed, sorted set of indices I = i0 < i1 < . . . < ik−1 of size k ≤ m, arrange in place the elements of A so that A[0, i0 − 1] ≤ A[i0] ≤ A[i0 + 1, i1 − 1] ≤ A[i1... |