+ All Categories
Home > Documents > 3-Way Partitioning

3-Way Partitioning

Date post: 06-Feb-2016
Category:
Upload: lang
View: 24 times
Download: 0 times
Share this document with a friend
Description:
3-Way Partitioning. 3-way partitioning. Choose partitioning element. Scan from left  element. Scan from right for  element. Exchange. Move to left or right end if equal. Repeat until pointers cross. A. B. X. W. P. P. V. P. D. P. C. Y. Z. P. p. q. partition element. - PowerPoint PPT Presentation
Popular Tags:
30
1 3-Way Partitioning 3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross. A B X W P P V P D P C Y Z P partitioned partition element unpartitioned p q
Transcript
Page 1: 3-Way Partitioning

1

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B X W P P V P D P C Y Z P

partitioned

partition element unpartitioned

p q

Page 2: 3-Way Partitioning

2

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B X W P P V P D P C Y Z P

p q

Page 3: 3-Way Partitioning

3

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B X W P P V P D P C Y Z P

p q

Page 4: 3-Way Partitioning

4

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B X W P P V P D P C Y Z P

p q

swap me

Page 5: 3-Way Partitioning

5

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B X W P P V P D P C Y Z P

p q

swap me

Page 6: 3-Way Partitioning

6

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B X W P P V P D P C Y Z P

p q

swap me

Page 7: 3-Way Partitioning

7

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B X W P P V P D P C Y Z P

p q

swap me swap me

Page 8: 3-Way Partitioning

8

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B C W P P V P D P X Y Z P

p q

Page 9: 3-Way Partitioning

9

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B C W P P V P D P X Y Z P

p q

swap me

Page 10: 3-Way Partitioning

10

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B C W P P V P D P X Y Z P

p q

swap me swap me

Page 11: 3-Way Partitioning

11

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

A B C P P P V P D W X Y Z P

p q

swap left

Page 12: 3-Way Partitioning

12

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P B C A P P V P D W X Y Z P

p q

Page 13: 3-Way Partitioning

13

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P B C A P P V P D W X Y Z P

p q

swap me

Page 14: 3-Way Partitioning

14

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P B C A P P V P D W X Y Z P

p q

swap me swap me

Page 15: 3-Way Partitioning

15

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P B C A D P V P P W X Y Z P

p q

swap right

Page 16: 3-Way Partitioning

16

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P B C A D P V P Z W X Y P P

p q

Page 17: 3-Way Partitioning

17

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P B C A D P V P Z W X Y P P

p q

swap me

Page 18: 3-Way Partitioning

18

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P B C A D P V P Z W X Y P P

p q

swap me swap me

Page 19: 3-Way Partitioning

19

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P B C A D P V P Z W X Y P P

p q

swap left

Page 20: 3-Way Partitioning

20

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P P C A D B V P Z W X Y P P

q

swap right

p

Page 21: 3-Way Partitioning

21

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P P C A D B V Y Z W X P P P

p q

Page 22: 3-Way Partitioning

22

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P P C A D B V Y Z W X P P P

p q

swap me

Page 23: 3-Way Partitioning

23

3-Way Partitioning

3-way partitioning. Choose partitioning element. Scan from left element. Scan from right for element. Exchange. Move to left or right end if equal. Repeat until pointers cross.

P P C A D B V Y Z W X P P P

p q

pointers cross

Page 24: 3-Way Partitioning

24

3-Way Partitioning

3-way partitioning. Swap elements on left with elements in middle. Swap elements on right with elements in middle.

P P C A D B Y Z W X P P P

p q

swap meswap me

V

Page 25: 3-Way Partitioning

25

3-Way Partitioning

3-way partitioning. Swap elements on left with elements in middle. Swap elements on right with elements in middle.

B P C A D P Y Z W X P P P

p q

swap meswap me

V

Page 26: 3-Way Partitioning

26

3-Way Partitioning

3-way partitioning. Swap elements on left with elements in middle. Swap elements on right with elements in middle.

B D C A P P Y Z W X P P P

p q

V

Page 27: 3-Way Partitioning

27

3-Way Partitioning

3-way partitioning. Swap elements on left with elements in middle. Swap elements on right with elements in middle.

B D C A P P Y Z W X P P P

p q

swap me swap me

V

Page 28: 3-Way Partitioning

28

3-Way Partitioning

3-way partitioning. Swap elements on left with elements in middle. Swap elements on right with elements in middle.

B D C A P P P Y Z W X P P V

p q

swap me swap me

Page 29: 3-Way Partitioning

29

3-Way Partitioning

3-way partitioning. Swap elements on left with elements in middle. Swap elements on right with elements in middle.

B D C A P P P P Z W X P Y V

p q

swap me swap me

Page 30: 3-Way Partitioning

30

3-Way Partitioning

3-way partitioning. Swap elements on left with elements in middle. Swap elements on right with elements in middle.

B D C A P P P P P W X Z Y V

p q

3-way partitioned!


Recommended