Presentation is loading. Please wait.

Presentation is loading. Please wait.

General Computer Science for Engineers CISC 106 James Atlas Computer and Information Sciences 10/23/2009.

Similar presentations


Presentation on theme: "General Computer Science for Engineers CISC 106 James Atlas Computer and Information Sciences 10/23/2009."— Presentation transcript:

1 General Computer Science for Engineers CISC 106 James Atlas Computer and Information Sciences 10/23/2009

2 Objectives Understand Selection Sort Compare to Quicksort

3 Algorithm for sorting (Selection Sort) 1. Find the minimum data in the set 2. Swap it with the first element of the set 3. Repeat Steps 1-2 for the remaining elements

4 10843125769 1843 25769 1243 85769 1234 85769 1234 85769 123458 769 123456 789 1234567 89 12345678 9 123456789 Running Time (Selection Sort) loop progress

5 Algorithm for sorting (Quick Sort) 1. Choose a random pivot point 2. Split your data into two sets: 1.Low - the data < pivot 2.High - the data > pivot 3. Repeat Steps 1-2 for both data sets 4. The sorted data is [low pivot high]

6 10843125769 184362579 154362789 124365789 124356789 123456789 123456789 Running Time (Quick Sort) recursion progress

7 10843125769 184362579 154362789 124365789 124356889 123458889 123456889 Running Time (Quick Sort) recursion progress If we divide the size of the data, n, in half at each step, how many steps does this take?

8 10843125769 184362579 154362789 124365789 124356889 123458889 123456889 Running Time (Quick Sort) recursion progress If we divide the size of the data, n, in half at each step, how many steps does this take? log n area of table = width * height = n * log n


Download ppt "General Computer Science for Engineers CISC 106 James Atlas Computer and Information Sciences 10/23/2009."

Similar presentations


Ads by Google