Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sorting 1. Insertion Sort 3 1 4 4 5 6 2 9 5 1 3 1 4 4 5 6 2 9 5 1 1 3 4 4 5 6 2 9 5 1 1 3 4 4 5 6 2 9 5 1 1 1 3 4 5 6 2 9 5 4 1 1 3 4 5 6 2 9 5 4 1 1 3.

Similar presentations


Presentation on theme: "Sorting 1. Insertion Sort 3 1 4 4 5 6 2 9 5 1 3 1 4 4 5 6 2 9 5 1 1 3 4 4 5 6 2 9 5 1 1 3 4 4 5 6 2 9 5 1 1 1 3 4 5 6 2 9 5 4 1 1 3 4 5 6 2 9 5 4 1 1 3."— Presentation transcript:

1 Sorting 1. Insertion Sort 3 1 4 4 5 6 2 9 5 1 3 1 4 4 5 6 2 9 5 1 1 3 4 4 5 6 2 9 5 1 1 3 4 4 5 6 2 9 5 1 1 1 3 4 5 6 2 9 5 4 1 1 3 4 5 6 2 9 5 4 1 1 3 4 5 6 2 9 5 4 1 1 2 4 5 6 9 5 4 3 1 1 2 4 5 9 6 5 4 3 1 1 2 4 9 6 5 5 4 3 1 1 2 9 6 5 5 4 4 3

2 Sorting 2. Selection Sort 3 1 4 4 5 6 2 9 5 1 3 1 4 9 5 6 2 4 5 1 3 1 4 9 6 5 2 4 5 1 3 1 4 9 6 5 2 4 5 1 3 1 4 9 6 5 5 4 2 1 3 1 4 9 6 5 5 4 2 1 3 1 2 9 6 5 5 4 4 1 1 1 2 9 6 5 5 4 4 3 1 1 2 9 6 5 5 4 4 3 1 1 2 9 6 5 5 4 4 3

3 Sorting 3. Bubble Sort 3 1 4 4 5 6 2 9 5 1 1 3 1 9 4 5 6 2 5 4 1 1 3 9 6 4 5 5 2 4 1 1 3 9 6 5 4 5 4 2 1 1 2 9 6 5 5 4 4 3 1 1 2 9 6 5 5 4 4 3 1 1 2 9 6 5 5 4 4 3 1 1 2 9 6 5 5 4 4 3 1 1 2 9 6 5 5 4 4 3 1 1 2 9 6 5 5 4 4 3

4 Lower Bound For Sorting Decision Tree a < b b < c a < b < c a < c < b c < a < b b < a < c b < c < a c < b < a a < b ^ a < c a < c b < a ^ c < a a < b b < a Y Y Y Y Y N N N N N

5 Optimal Sorting Algorithms 4. Heapsort 2 4 16 10 3 14 9 8 7 1 Output:

6 Optimal Sorting Algorithms 4. Heapsort 16 2 1 14 10 3 8 9 4 7 Output:

7 Optimal Sorting Algorithms 4. Heapsort 2 10 9 3 8 1 4 7 1614 Output:

8 Optimal Sorting Algorithms 4. Heapsort 161410 Output: 9 3 2 8 1 4 7

9 Optimal Sorting Algorithms 4. Heapsort 161410 9 Output: 8 3 7 1 4 2

10 Optimal Sorting Algorithms 4. Heapsort 161410 9 8 Output: 7 3 4 4 2

11 Optimal Sorting Algorithms 4. Heapsort 161410 9 8 7 Output: 4 3 2 1

12 Optimal Sorting Algorithms 4. Heapsort 161410 9 8 7 4 Output: 3 1 2

13 Optimal Sorting Algorithms 4. Heapsort 3161410 9 8 7 4 Output: 2 1

14 Optimal Sorting Algorithms 4. Heapsort 2 3161410 9 8 7 4 Output: 1 1 2 3161410 9 8 7 4 Final Output:

15 5. Mergesort 3 1 4 4 5 6 2 9 5 1 3 1 4 5 1 4 5 6 2 9 3 1 4 5 1 2 9 4 5 6 3 1 4 5 1 9 2 6 4 5 Optimal Sorting Algorithms 5 1 4 5 1 3 5 1 9 2 5 4 1 5 4 6 5 4 1 1 3 5 4 9 6 5 4 2 1 12 9 6 5 5 4 43

16 4 1 6. Quicksort. Partitioning Phase 5 3 21011 4 1 6 7 9 8 5 3 21011 4 1 6 7 9 8 Pivot 5 3 21011 9 1 6 7 4 8 5 3 21011 9 1 6 7 4 8 5 3 21011 9 1 6 7 4 8 5 3 21011 9 7 6 1 4 8 5 3 21011 9 7 6 8


Download ppt "Sorting 1. Insertion Sort 3 1 4 4 5 6 2 9 5 1 3 1 4 4 5 6 2 9 5 1 1 3 4 4 5 6 2 9 5 1 1 3 4 4 5 6 2 9 5 1 1 1 3 4 5 6 2 9 5 4 1 1 3 4 5 6 2 9 5 4 1 1 3."

Similar presentations


Ads by Google