Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sorting Quick, Merge & Radix Divide-and-conquer Technique subproblem 2 of size n/2 subproblem 1 of size n/2 a solution to subproblem 1 a solution to.

Similar presentations


Presentation on theme: "Sorting Quick, Merge & Radix Divide-and-conquer Technique subproblem 2 of size n/2 subproblem 1 of size n/2 a solution to subproblem 1 a solution to."— Presentation transcript:

1

2 Sorting Quick, Merge & Radix

3 Divide-and-conquer Technique subproblem 2 of size n/2 subproblem 1 of size n/2 a solution to subproblem 1 a solution to the original problem a solution to subproblem 2 a problem of size n

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25 Best Case If we are lucky, Partition splits the array evenly

26 Worst Case What is the worst case? One side of the parition has only one element

27 Worst Case (2)

28 Merge Sort

29 Using Divide and Conquer: Mergesort Mergesort Strategy Sorted Merge Sorted Sort recursively by Mergesort first last  (first  last)  2 

30

31

32 Algorithm

33

34

35 Radix Sort

36

37

38

39

40 Least-significant-digit-first Example: 275, 087, 426, 061, 509, 170, 677, 503

41

42


Download ppt "Sorting Quick, Merge & Radix Divide-and-conquer Technique subproblem 2 of size n/2 subproblem 1 of size n/2 a solution to subproblem 1 a solution to."

Similar presentations


Ads by Google