lars arge1 permuting lower bound permuting n elements according to a given permutation takes i/os in...

4
Lars Arge 1 Permuting Lower Bound Permuting N elements according to a given permutation takes I/Os in “indivisibility” model Indivisibility model: Move of elements only allowed operation Note: We can allow copies (and destruction of elements) Bound also a lower bound on sorting Proof: View memory and disk as array of N tracks of B elements }) log , (min{ B N B N B M N I/O-efficient Algorithms and Data Structures M D

Upload: gwendolyn-fitzgerald

Post on 02-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lars Arge1 Permuting Lower Bound Permuting N elements according to a given permutation takes I/Os in “indivisibility” model Indivisibility model: Move

Lars Arge 1

Permuting Lower BoundPermuting N elements according to a given permutation takes

I/Os in “indivisibility” model

• Indivisibility model: Move of elements only allowed operation• Note:

– We can allow copies (and destruction of elements)– Bound also a lower bound on sorting

• Proof:– View memory and disk as array of N tracks of B elements– Assume all I/Os track aligned (assumption can be removed)

})log,(min{BN

BN

BMN

I/O-efficient Algorithms and Data Structures

M D

Page 2: Lars Arge1 Permuting Lower Bound Permuting N elements according to a given permutation takes I/Os in “indivisibility” model Indivisibility model: Move

Lars Arge 2

Permuting Lower Bound– Array contains permutation of N elements at all times– We will count how many permutations can be

reached (produced) with t I/Os– Input:

* Choose track: N possibilities* Rearrange ≤ B element in track and place among ≤ M-B

elements in memory:–

possibilities if “fresh” track

– otherwise

at most permutations after t inputs– Output: Choose track: N possibilities

BN

B

M BN t )!())((

)(!B

MB )(

B

M

I/O-efficient Algorithms and Data Structures

M D

Page 3: Lars Arge1 Permuting Lower Bound Permuting N elements according to a given permutation takes I/Os in “indivisibility” model Indivisibility model: Move

Lars Arge 3

Permuting Lower Bound– Permutation algorithm needs to be able to produce N! permutations

(using Stirlings formula and )– If we have– If we have and thus

!)!())(( NBN BN

B

M t

)!log())log((log)!log( NNtBB

M

BN

NNBNtBN BM log)log(loglog

BM

BN

BN

Nt

loglog

log

xxx log!log BMB

B

M log)log(

BMBN loglog B

NBMB

NB

N

BMBN

t /log2

loglog

BMBN loglog NB

NNNNNt NB

N

NBN

21

21

loglog

21

log2

log

})log,(min{ BN

BN

BMNt

I/O-efficient Algorithms and Data Structures

Page 4: Lars Arge1 Permuting Lower Bound Permuting N elements according to a given permutation takes I/Os in “indivisibility” model Indivisibility model: Move

Lars Arge 4

Sorting lower bound• Similar argument but assuming comparison model in internal memory

– Initially N! possible orderings– Count how may possible after t I/Os

Sorting N elements takes I/Os in comparison model

!)!())(( NBN BN

B

M t

)!log())log((log)!log( NNtBB

M

BN

NNBNtBN BM log)log(loglog

BM

BN

BN

Nt

loglog

log

)log(BN

BN

BM

I/O-efficient Algorithms and Data Structures