Recall & Review
beginner
What is the main idea behind the Shell Sort Algorithm?
Shell Sort improves insertion sort by comparing elements far apart first, then reducing the gap between elements to be compared. This helps move elements closer to their correct position faster.
Click to reveal answer
beginner
How does Shell Sort decide which elements to compare?
Shell Sort uses a gap sequence to decide which elements to compare. It starts with a large gap and reduces it until the gap is 1, performing insertion sort at each gap size.
Click to reveal answer
intermediate
What is the time complexity of Shell Sort in the average case?
The average time complexity of Shell Sort depends on the gap sequence but is generally around O(n^(3/2)) or better with good gap choices.
Click to reveal answer
intermediate
Why is Shell Sort faster than simple insertion sort for large lists?
Shell Sort moves elements over large gaps early on, reducing the total number of movements needed when the gap becomes small, unlike insertion sort which moves elements one step at a time.
Click to reveal answer
beginner
Describe the final step of Shell Sort when the gap is 1.
When the gap is 1, Shell Sort performs a normal insertion sort on the almost sorted list, which is efficient because the list is already partially sorted from previous steps.
Click to reveal answer
What does Shell Sort use to decide which elements to compare?
✗ Incorrect
Shell Sort uses a gap sequence to compare elements that are far apart, gradually reducing the gap.
What is the final gap value used in Shell Sort?
✗ Incorrect
The final gap in Shell Sort is always 1, where it performs a normal insertion sort.
Why is Shell Sort faster than insertion sort on large lists?
✗ Incorrect
Shell Sort moves elements over large gaps early, reducing the total movements needed later.
Which sorting method does Shell Sort use at each gap step?
✗ Incorrect
Shell Sort uses insertion sort at each gap step to sort elements separated by the gap.
What is a common time complexity for Shell Sort with a good gap sequence?
✗ Incorrect
With a good gap sequence, Shell Sort runs in about O(n^(3/2)) time on average.
Explain how Shell Sort improves over simple insertion sort.
Think about how moving elements far apart early helps sorting.
You got /4 concepts.
Describe the role of the gap sequence in Shell Sort and how it affects performance.
Gap sequence controls the sorting steps.
You got /4 concepts.