lecture 15

20
Randomized Algorithms CS648 Lecture 15 Randomized Incremental Construction (building the background) 1

Upload: rajiv-omar

Post on 04-Jul-2015

75 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Lecture 15

Randomized AlgorithmsCS648

Lecture 15

Randomized Incremental Construction

(building the background)

1

Page 2: Lecture 15

Partition Theorem

2

ΩB

This theorem solves many difficult

problems magically. But one needs some

experience in order to

apply it effectively. You will realize it

soon.

Page 3: Lecture 15

PROBLEM 1FIND-MIN PROBLEM

3

Page 4: Lecture 15

Find-Min algorithm

4

8 5 16 11 32 4 57 6 19 82 7 42 2 23

1 2 3 4 5 6 7 8 9 10 11 12 13 14

A

??

Page 5: Lecture 15

Find-Min algorithm

5

1 2 …

A

Page 6: Lecture 15

PROBLEM 2CLOSEST PAIR OF POINTS

6

Page 7: Lecture 15

Closest Pair of Points

7

Page 8: Lecture 15

Notations and assumptions

8

Page 9: Lecture 15

A discrete math exercise

Exercise:

What is the maximum number of points that can be placed in a unit square such that the minimum distance is at least 1 ?

Answer: 4.

This exercise is used is deterministic algorithm as well the randomized algorithm that we shall discuss now.

9

1

If there are more than 4 points, at least one

of the four small squares will have

more than 1 points.

Page 10: Lecture 15

Overview of the randomized algorithm

• Incremental algorithm:

starts with a set of 2 points, computes their distance;

inserts 3rd point and updates the closest pair distance;

inserts 4th point and updates the closest pair distance;

• Uses an efficient data structure, called Grid, to facilitate efficient processing during ith step:

- To determine if ith point is going to change the closest pair distance.

10

Page 11: Lecture 15

11

Page 12: Lecture 15

Height Balanced Binary search tree

Dynamic hashing

12

The following time bounds are possible.

Excluding Insert_point() operation, show as a homework, that we can achieve all other bounds using static hashing discussed in this course.

Page 13: Lecture 15

Closest Pair of Points

13

Page 14: Lecture 15

14

Page 15: Lecture 15

15

We need to rebuild the grid

Page 16: Lecture 15

16

Page 17: Lecture 15

17

O(1)

O(1)

O(1)

Page 18: Lecture 15

18

Page 19: Lecture 15

19

Page 20: Lecture 15

Homework Exercise

• Investigate the cause of problem in our forward analysis for each of the two problems.

• Try to find alternate approach for analysis.

(Backward analysis )

• Provide efficient implementation of Grid data structure.

20

I am hopeful that at least one of

you will reinvent this technique on

his/her own before next class.