sorting integers in the ram model gerth stlting brodal joint work with djamal belazzougui and jesper...

6
Sorting Integers in the RAM Model Gerth Stølting Brodal Joint work with Djamal Belazzougui and Jesper Sindal Nielsen (to be presented at the 14th Scandinavian Workshop on Algorithm Theory) MADALGO Review Meeting, April 28, 2014

Upload: albert-barber

Post on 19-Jan-2018

215 views

Category:

Documents


0 download

DESCRIPTION

Comparison Based Sorting next scanning

TRANSCRIPT

Page 1: Sorting Integers in the RAM Model Gerth Stlting Brodal Joint work with Djamal Belazzougui and Jesper Sindal Nielsen (to be presented at the 14th Scandinavian

Sorting Integers in the RAM Model

Gerth Stølting Brodal

Joint work with Djamal Belazzougui and Jesper Sindal Nielsen(to be presented at the 14th Scandinavian Workshop on Algorithm Theory)

MADALGO Review Meeting, April 28, 2014

Page 2: Sorting Integers in the RAM Model Gerth Stlting Brodal Joint work with Djamal Belazzougui and Jesper Sindal Nielsen (to be presented at the 14th Scandinavian

58 13 138 55 141 137 11 53 10 54

Sorting (Integers)

00001010 00001010 00001101 00110101 00110110 00110111 00111010 10001001 10001010 1000110110 11 13 53 54 55 58 137 138 141

00111010 00001101 10001010 00110111 10001101 10001001 00001010 00110101 00001010 00110110Input

Output

1 2 3 4 5 6 7 8 9 10

12 34 567 89 10

w bits

n integers

Trie

12 34 567 89 10

Patricia trie(branching charcters only)

permutation0

0

0

1

1

1

1

0

1

0

1

0

1

0

1

0

0

0

1

1

1

1

0

0

0

1

1

1

0

0

0

1

10

1 10

0

0

0

-

-

1

-

1

-

1

-

-

-

-

-

1

0

-

0

1

-

1

-

0

-

-

-

1

-

-

-

0

-

10

- -0

0

Page 3: Sorting Integers in the RAM Model Gerth Stlting Brodal Joint work with Djamal Belazzougui and Jesper Sindal Nielsen (to be presented at the 14th Scandinavian

Merge sort: von Neumann 1945

Ford et al. 1959: Lower bound ≥ comparions

Comparison Based Sorting

11 13 53 55 58 137 138 141

58

13

138

55

141

54

137

53

10

11

13 58

55 138

137 141

11 53

10 54

13 55 58 138

11 53 137 141

10 11 13 53 54 55 58 137 138 141

comparions

next

next

next

13 55 58 138

11 53 137 141

11 13 53 55 58 137 138 141

scanning

scanning

scanning

Page 4: Sorting Integers in the RAM Model Gerth Stlting Brodal Joint work with Djamal Belazzougui and Jesper Sindal Nielsen (to be presented at the 14th Scandinavian

Sorting Networks

O(n·log2 n) size : Batcher 1968O(n·log n) size : Ajtai, Komlós, Szemerédi 1983; Paterson 1990; Goodrich 2014

138

13

58

55

13

138

55

58

13

55

58

138

55

58

138

13

58

55

13

55

58

138

Input Output

Original motivated by hardware implementations

Renewed interest since data-oblivious̶C applications in privacy preserving computations ̶C allows for parallel computations on bit-level and GPU

Page 5: Sorting Integers in the RAM Model Gerth Stlting Brodal Joint work with Djamal Belazzougui and Jesper Sindal Nielsen (to be presented at the 14th Scandinavian

Results

Bucket sort O(n+2w)

Radix sort; Hollerith 1887van Emde Boas 1975Willard 1983

superlinear spaceexpected

Kirkpatrick and Reicsh 1983

Merge sort: von Neumann 1945 comparison based optimal

Thorup and Han 2002 expected

Andersson et al. 1998 O(n) expected,

NEW O(n) expected,

Time per element

wlog2 n·loglog n log2+ε n

O (√ log log n )

O(1)

log n

1

2

3

1

2

3

NEW

Page 6: Sorting Integers in the RAM Model Gerth Stlting Brodal Joint work with Djamal Belazzougui and Jesper Sindal Nielsen (to be presented at the 14th Scandinavian

Open Question

Sorting in linear time for all w?

wlog2 n·loglog n log2+ε n

O (√ log log n )

O(1)

log n

NEW

Time per element