Counting inversions in lists

9 years 1 months ago
Counting inversions in lists
In a recent paper, Ajtai et al. [1] give a streaming algorithm to count the number of inversions in a stream Ä ¾ Ñ Ò using two passes and Ç´¯ ½ ÔÒÐÓ Ò´ÐÓ Ñ·ÐÓ Òµµspace. Here, we present a simple randomized streaming algorithm for the same problem that uses one pass and Ç´¯ ¿ ÐÓ ¾ ÒÐÓ Ñµ space. Our algorithm is based on estimating quantiles of the items already seen in the stream, and using that to estimate the number of inversions involving each element. 1 Preliminaries Let Ä be the list of elements appearing as a stream with the ’th element being denoted by Ä . The quantity we want to approximate is ôĵ, the number of inversions in Ä; this is the number of pairs such that Ä Ä . In order to simplify our notation, we restate this in an equivalent form, that of counting non-inversions in the list when the total order, and thus the results of all strict comparisons, has been reversed. Thus, all comparisons between list elements in what fol...
Anupam Gupta, Francis Zane
Added 01 Nov 2010
Updated 01 Nov 2010
Type Conference
Year 2003
Where SODA
Authors Anupam Gupta, Francis Zane
Comments (0)