Download presentation
Presentation is loading. Please wait.
1
CSCI 3333 Data Structures Sorting Exercises
by Dr. Bun Yue Professor of Computer Science
2
General Sorting Algorithm
Linda claims to have an sorting algorithm to sort an array S into a sorted array T. Give an O(n) algorithm isSorted to check whether T is sorted. Explain why isSorted is not sufficient to prove that a particular output T is a sorting of S. Describe what additional information Linda’s algorithm could output so that her algorithm’s correctness could be established on any given S and T in O(n) time. With the additional information from (3), construct an O(n) algorithm to check whether T is a sorting of S.
3
Shell Sort Shown the evolution of Shell Sort using a gap sequence of (5,3,1) with the array {29, 11, 18, 50, 20, 33, 13, 80, 79, 61, 11, 54, 77, 68, 22, 60, 56}. Show each recursive call and the action involved.
4
QuickSort Use the C++ implementation in the lecture:
5
QuickSort
6
QuickSort Show the evolution of sorting the array [10, 7, 3, 22, 90, 33, 21, 4, 90, 68, 50] by showing each recursive calls and their actions.
7
Questions and Comments?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.