Ola Petersson
Lund University
Network
Latest external collaboration on country level. Dive into details by clicking on the dots.
Publication
Featured researches published by Ola Petersson.
Discrete Applied Mathematics | 1995
Ola Petersson; Alistair Moffat
Abstract A sorting algorithm is adaptive if it sorts sequences that are close to sorted faster than random sequences, where the distance is determined by some measure of presortedness. Over the years several measures of presortedness have been proposed in the literature, but it has been far from clear how they relate to each other. We show that there exists a natural partial order on the set of measures, which makes it possible to say that some measures are superior to others. We insert all known measures of presortedness into the partial order, and thereby provide a powerful tool for evaluating both measures and adaptive sorting algorithms. We further present a new measure and show that it is a maximal element in the partial order formed by all known measures, and thus that any sorting algorithm that optimally adapts to the new measure also optimally adapts to all other known measures of presortedness. We have not succeeded in developing an optimal algorithm for the new measure; however, we present one that is optimal in terms of comparisons.
SIGAL '90 Proceedings of the international symposium on Algorithms | 1990
Svante Carlsson; Christos Levcopoulos; Ola Petersson
The complexity of merging two sorted sequences into one is linear in the worst case as well as in the average case. There are, however, instances for which a sublinear number of comparisons is sufficient. We consider the problem of measuring and exploiting such instance easiness. The merging algorithm presented, Adaptmerge, is shown to adapt optimally to different kinds of measures of instance easiness. In the sorting problem the concept of instance easiness has received a lot of attention, and it is interpreted by a measure of presortedness. We apply Adaptmerge in the already adaptive sorting algorithm Natural Mergesort. The resulting algorithm, Adaptive Mergesort, optimally adapts to several, known and new, measures of presortedness. We also prove some interesting results concerning the relation between measures of presortedness proposed in the literature.
Software - Practice and Experience | 1996
Alistair Moffat; Gary Eddy; Ola Petersson
Adaptivity in sorting algorithms is sometimes gained at the expense of practicality. We give experimental results showing that Splaysort - sorting by repeated insertion into a Splay tree - is a surprisingly efficient method for in-memory sorting. Splaysort appears to be adaptive with respect to all accepted measures of presortedness, and it outperforms Quicksort for sequences with modest amounts of existing order. Although Splaysort has a linear space overhead, there are many applications for which this is reasonable. In these situations Splaysort is an attractive alternative to traditional comparison-based sorting algorithms such as Heapsort, Mergesort, and Quicksort.
Information & Computation | 1994
Christos Levcopoulos; Ola Petersson
We present a new sorting algorithm that adapts to existing order within an input sequence. Let k be the smallest integer such that a sequence X of length n can be reduced to the empty sequence by the removal of k monotone, increasing or decreasing subsequences. The algorithm, Slabsort, sorts X in O(n log k) time, without knowing k beforehand, which is optimal in a comparison-based model.
Algorithmica | 1993
Svante Carlsson; Christos Levcopoulos; Ola Petersson
The complexity of merging two sorted sequences into one is linear in the worst case as well as in the average case. There are, however, instances for which a sublinear number of comparisons is sufficient. We consider the problem of measuring and exploiting such instance easiness. The merging algorithm presented, Adaptmerge, is shown to adapt optimally to different kinds of measures of instance easiness. In the sorting problem the concept of instance easiness has received a lot of attention, and it is interpreted by a measure of presortedness. We apply Adaptmerge in the already adaptive sorting algorithm Natural Mergesort. The resulting algorithm, Adaptive Mergesort, optimally adapts to several, known and new, measures of presortedness. We also prove some interesting results concerning the relation between measures of presortedness proposed in the literature.
symposium on discrete algorithms | 1998
Arne Andersson; Ola Petersson
Let the position of a list element in a list be the number of elements preceding it plus one. Anindexed listsupports the following operations on a list: Insert; delete; return the position of an element; and return the element at a certain position. The order in which the elements appear in the list is completely determined by where the insertions take place; we do not require the presence of any keys that induce the ordering.We considerapproximate indexed listsand show that a tiny relaxation in precision of the query operations allows a considerable improvement in time complexity. The new data structure has applications in two other problems; namely,list labelingandsubset rank.
Acta Informatica | 1998
Alistair Moffat; Ola Petersson; Nicholas C. Wormald
Abstract. We demonstrate that if standard Mergesort is implemented using finger search trees instead of arrays it optimally adapts to a set of measures of presortedness not fulfilled by any other algorithm.
symposium on the theory of computing | 1994
Arne Andersson; Torben Hagerup; Johan Håstad; Ola Petersson
( ;iven n strings arranged in alphabetical order, how many characters must we probe to determine whether a k-character query string is present? If k is a constant, we can solve i IIe problem with @(log n) probes by means of binary search, .Ind this is optimal, but what happens for larger values of k? The question 1s a fundamental one; we are simply askiiig for the complexity of searching a dictionary for a string, ~vhere the common assumption that entire strings can be compared in constant time is replaced by the more conservative assumption that only single characters can be compmed in constant time. For s&iciently long strings, the latter assumption seems more realistic. At first glance the problem may appear easy — some liind of generalized binary search should do the trick. However, closer acquaintance with the problem reveals a surprising, intricacy. 13eing slightly more precise, we consider finite strings of characters drawn from an arbitrary, ordered alphabet.
Theoretical Computer Science | 1996
Christos Levcopoulos; Ola Petersson
Abstract We consider the problem of taking advantage of existing order within the input sequence when sorting. The measure of presortedness used is the number of inversions. Let X be a sequence of length n and let Inv(X) be the (unknown) number of inversions in X . Our main results are: • • X can be sorted in-place , i.e. using only O ( log n ) bits of extra space, in time O(n log( Inv(X) n )) , which is optimal with respect to the number of inversions. • • Given p processors on an EREW PRAM, X can be sorted in time O( n log( Inv(X) n ) p + log n) , which is optimal with respect to the number of inversions.
mathematical foundations of computer science | 1992
Torben Hagerup; Ola Petersson
We show that strings of characters, equipped with the usual lexicographical ordering, can be merged and sorted in parallel as efficiently as integers, although with some loss in speed. Specifically, our main results are: Two sorted lists of strings, containing altogether n characters, can be merged with an optimal time-processor product of O(n) in O(log n) time on a CRCW PRAM, and in O((log n)2) time on an EREW PRAM. Suppose that n integers of size polynomial in n can be sorted in time O(t(n)) with a time-processor product of O(nf(n)) on a CRCW PRAM, a CREW PRAM or an EREW PRAM, for nondecreasing functions t, f: ℕ → ℕ. Then a list of strings, containing altogether n characters drawn from an alphabet of size polynomial in n, can be sorted in time O(t(n) log n) with a time-processor product of O(n f(n) + n log log n) on a PRAM of the same type. In particular, such a list can be sorted in O((log n) 2/log log n) time with a time-processor product of O(n log log n) on a CRCW PRAM.