Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move.

Similar presentations


Presentation on theme: "1 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move."— Presentation transcript:

1 1 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABXWPPVPDPCYZP partitioned partition elementunpartitioned pq

2 2 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABXWPPVPDPCYZP pq

3 3 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABXWPPVPDPCYZP pq

4 4 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABXWPPVPDPCYZP pq swap me

5 5 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABXWPPVPDPCYZP pq swap me

6 6 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABXWPPVPDPCYZP pq swap me

7 7 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABXWPPVPDPCYZP pq swap me

8 8 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABCWPPVPDPXYZP pq

9 9 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABCWPPVPDPXYZP pq swap me

10 10 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABCWPPVPDPXYZP pq swap me

11 11 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. ABCPPPVPDWXYZP pq swap left

12 12 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PBCAPPVPDWXYZP pq

13 13 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PBCAPPVPDWXYZP pq swap me

14 14 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PBCAPPVPDWXYZP pq swap me

15 15 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PBCADPVPPWXYZP pq swap right

16 16 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PBCADPVPZWXYPP pq

17 17 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PBCADPVPZWXYPP pq swap me

18 18 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PBCADPVPZWXYPP pq swap me

19 19 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PBCADPVPZWXYPP pq swap left

20 20 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PPCADBVPZWXYPP q swap right p

21 21 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PPCADBVYZWXPPP pq

22 22 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PPCADBVYZWXPPP pq swap me

23 23 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move to left or right end if equal. n Repeat until pointers cross. PPCADBVYZWXPPP pq pointers cross

24 24 3-Way Partitioning 3-way partitioning. n Swap elements on left with elements in middle. n Swap elements on right with elements in middle. PPCADBYZWXPPP pq swap me V

25 25 3-Way Partitioning 3-way partitioning. n Swap elements on left with elements in middle. n Swap elements on right with elements in middle. BPCADPYZWXPPP pq swap me V

26 26 3-Way Partitioning 3-way partitioning. n Swap elements on left with elements in middle. n Swap elements on right with elements in middle. BDCAPPYZWXPPP pq V

27 27 3-Way Partitioning 3-way partitioning. n Swap elements on left with elements in middle. n Swap elements on right with elements in middle. BDCAPPYZWXPPP pq swap me V

28 28 3-Way Partitioning 3-way partitioning. n Swap elements on left with elements in middle. n Swap elements on right with elements in middle. BDCAPPPYZWXPPV pq swap me

29 29 3-Way Partitioning 3-way partitioning. n Swap elements on left with elements in middle. n Swap elements on right with elements in middle. BDCAPPPPZWXPYV pq swap me

30 30 3-Way Partitioning 3-way partitioning. n Swap elements on left with elements in middle. n Swap elements on right with elements in middle. BDCAPPPPPWXZYV pq 3-way partitioned!


Download ppt "1 3-Way Partitioning 3-way partitioning. n Choose partitioning element. n Scan from left  element. n Scan from right for  element. n Exchange. n Move."

Similar presentations


Ads by Google