Download presentation

Presentation is loading. Please wait.

Published byPatrick Beverly Modified over 3 years ago

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!

Similar presentations

OK

Partitioning in Quicksort n How do we partition the array efficiently? – choose partition element to be rightmost element – scan from right for smaller.

Partitioning in Quicksort n How do we partition the array efficiently? – choose partition element to be rightmost element – scan from right for smaller.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on area of parallelogram and triangles worksheets Ppt on speed control of dc shunt motor Ppt on world book day costume Ppt on quality education Ppt on security attacks in information security Ppt on dispersal of seeds by animals games Ppt on zener diode basics Haptic communication ppt on paper Ppt on porter's five forces analysis Ppt on 3d hologram technology