Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 3 Sorting and Selection. Comparison Sort.

Similar presentations


Presentation on theme: "Lecture 3 Sorting and Selection. Comparison Sort."— Presentation transcript:

1 Lecture 3 Sorting and Selection

2 Comparison Sort

3 Decision Tree

4 Running Time Is there a faster sorting of other type?

5 Counting sort

6

7

8 Counting sort (Running Time)

9 A Student’s Variation

10 Counting sort is stable. That is, the same value appear in the output array in the same order as they do in the input array.

11 Radix Sort

12 Running Time

13 An Application: Selection Problem

14 If we use comparison, what is the lower bound?

15 Randomized Selection

16 Running time

17 Selection with O(n) Comparisons

18

19

20

21 Why? See next page!!!

22 ( + low side) contains red part ( + high side) contains blue part

23 Analysis

24

25 What we learnt in this lecture? What is “comparison sort”?. Lower bound for comparison sort. Counting sort and Radix sort. What is selection problem? expected linear time and linear time selections.

26 Puzzle


Download ppt "Lecture 3 Sorting and Selection. Comparison Sort."

Similar presentations


Ads by Google