two topics in adaptive algorithms: hulls and strings robert fraser university of waterloo

14
Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Post on 21-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Two Topics in Adaptive Algorithms:

Hulls and Strings

Robert Fraser

University of Waterloo

Page 2: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

2

What to expect

• Convex Hulls– Adaptive sorting, measures of difficulty– Techniques– Adaptivity of output sensitive

techniques

• String Matching– Online string matching– Boyer Moore Horspool technique– Adaptive string matching

Page 3: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Adaptive Sorting

• All kinds of techniques and measures (see Estivill-Castro & Wood, 89)

• I love Straight Merge Sort!

(Odd-even sms is pretty good too…)

3

Page 4: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Planar Convex Hulls

• Many techniques– Gift wrapping– Graham Scan– Output sensitive– Adaptive (Levcopolous et al., Barbay & Chen)– New adaptive techniques?

4

Page 5: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Adaptivity of CSY-hull

• Ω(n log h)

• Add a step CHECKHULL to give adaptivity

• Considering performance on a good instance however, you get CUPS

• Could also determine difficulty of interior points…

5

Page 6: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Adaptivity wrt Max!

6Max

Com

paris

ons

QuicksortLP-odd-even sms

LP sort

Odd-even sms

Straight mergesort

Page 7: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Adaptivity wrt Runs!

7Runs

Com

paris

ons

Quicksort

LP-odd-even sms

LP sort

Odd-even sms

Straight mergesort

Straight mergesortwith reverse!

Page 8: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Busiest slide ever?

8

Page 9: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

New York GIS data

264346 points, 33 on hull

sm: 4346700

oesm: 4351874

lpoesm: 6056577

lp: 9408131

gs: 5792637

dis: 263950

max: 2074199

Page 10: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

10

String Matching Techniques

• Naïve – standard sliding window – θ(n·m)

• Linear time – as discussed by KMP– O(n+m)

• Expected sublinear – We’ll look at the standard Boyer-Moore

Horspool, but there are many!– O(n log m/m +m) expected, O(n·m) worst case

Page 11: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Boyer Moore Horpsool

11

0 1 2 3 4 5 6 7 8 9 10

b b b c b a a c c a a

a c c a a

Page 12: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

String Matching with More Jumps

• Try to maximize the jumps with Horspool-type searching

12

Page 13: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

Extensions

• Uneven distribution of data

• 2D string matching

• Applications (bioinformatics)

• Works best on small alphabets with many repeats

13

Page 14: Two Topics in Adaptive Algorithms: Hulls and Strings Robert Fraser University of Waterloo

14

Thanks

• Questions?

Supported by NSERC and the University of

Waterloo