Fast Sorting and PatternAvoiding Permutations - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Fast Sorting and PatternAvoiding Permutations

Description:

Pattern-Avoiding Permutations. David Arthur. Stanford University. A ... of 'pattern-avoiding ... n permutation avoids some pattern of length O(n0.5) ... – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 23
Provided by: stan7
Category:

less

Transcript and Presenter's Notes

Title: Fast Sorting and PatternAvoiding Permutations


1
Fast Sorting andPattern-Avoiding Permutations
  • David Arthur
  • Stanford University

2
Sorting
  • A classical problem
  • Sort a list of n distinct items
  • A classical theorem
  • At least O(n log n) comparisons are required
  • Proof
  • Need to distinguish between n! input orderings
  • Takes lg(n!) O(n log n) comparisons

3
The Challenge
  • What if not every input ordering is possible?
  • Example 1
  • Maintain a sorted list
  • Some items have changed since list was last
    sorted
  • But the list is still almost sorted
  • What is the sorted order now?
  • No decreasing subsequence of length k
  • Can sort in O(n log k) time

4
The Challenge
  • What if not every input ordering is possible?
  • Example 2
  • Profile a computer program
  • Store data every time a function call finishes
  • In what order were the functions called?
  • No subsequence ordered like (3,1,2)
  • Can sort in O(n) time

5
The Common Thread
  • Examples of pattern-avoiding permutations
  • A permutation p contains s if p has a
    subsequence ordered in the same way as s
  • Otherwise p avoids s
  • Example (4,2,5,1,3) contains (1,3,2)

Sortedorder
Given order
6
Why this?
  • Continuum of complexity on permutations
  • Every length n permutation avoids some pattern of
    length O(n0.5)
  • For fixed s, permutations avoiding s are simple
  • Theorem Marcus, Tardos 04At most Cn
    permutations of length n avoid s
  • Theoretical possibility Can sort any s-avoiding
    permutation in lg Cn O(n) time.

7
The Big Question
  • Suppose the input ordering p is known to avoid
    some s
  • Can p be sorted in less than O(n log n) time?
  • Hard question!
  • This talk
  • For many s, you can sort in O(n log log log n)
    time
  • If so, call s good
  • Approach find operations preserving goodness

8
Symmetry
  • Reverse pattern
  • r(s1, s2,, ss) (ss, ss-1,, s1)
  • e.g., r(1,3,2) (2,3,1)
  • Fact If s is good, then r(s) is good
  • If p avoids r(s), then r(p) avoids s
  • Algorithm Reverse p, then sort it

9
Symmetry
  • Complement pattern
  • (s1, s2,, ss) (s1s1, s1s2,, s1ss)
  • e.g., (1,3,2) (3,1,2)
  • Fact If s is good, then s is good
  • If p avoids s under lt ordering,then p avoids s
    under gt ordering
  • Algorithm Sort p under gt ordering, then reverse
    it

10
Our Result
  • Direct sums
  • (s1, s2,, ss) (t1, t2,, tt) (s1, s2,,
    ss, st1, st2,, stt)
  • e.g., (1,3,2) (2,1) (1,3,2,5,4)
  • Theorem If s and t are good, then s t is good
  • This talk If s is good, then (1) s is good

11
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Step 1 Preprocess p to find minimal elements
    (nothing below and left of them)

O(n) time
Minimal elementsSet k of min. elements
12
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Step 2 Partition p into columns around min.
    elements

O(n) time
Columns of columns k
13
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Remark Each column avoids s

If a column contains a sequence ordered like s
14
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Remark Each column avoids s

then p contains a sequence ordered like (1) s,
which is impossible.
15
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Step 3 Recursively sort each column

O(n log log log n) time
16
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Step 4 Merge each sorted column with minimal
    elements to partition p into rows

O(n k2) time
Rows of rows of columns k
17
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Step 5 Recursively sort each row(each row
    avoids s)

O(n log log log n) time
18
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Step 6 Concatenate the sorted rows

O(n) time
19
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 1
  • Summary O(n log log log n k2) time
  • What if k is large?

20
Proof
  • Goal if s is good, then (1) s is good
  • Algorithm 2
  • Partition p into O(log log n) layers, each with a
    small number of minimal elements
  • Sort each layer with Algorithm 1
  • Merge the results
  • O(n log log log n) time

21
Summary
All length 4 patterns (by symmetry class)
22
Summary
  • Just a start on a difficult problem!
Write a Comment
User Comments (0)
About PowerShow.com