Quiz 2 Flashcards
Is heapsort a stable sorting algorithm?
No, it is not stable.
Does heapsort sort in place?
Yes, it sorts in place.
Is insertion sort stable?
Yes, insertion sort is stable.
Is insertion sort in-place?
Yes, insertion sort operates in place.
Is merge sort stable?
Yes, merge sort is stable.
Is merge sort in-place?
No, merge sort requires extra space.
What is the lower bound for comparison-based sorting algorithms?
Ω(n log n)
What is the runtime of randomized quicksort in the average case?
O(nlogn)
Is quicksort stable?
No, quicksort is not a stable sorting algorithm.
Does quicksort sort in place?
Yes, quicksort operates in place.
Is selection sort stable?
No, selection sort is not stable.
Is selection sort in-place?
Yes, it sorts in place.
What is heapsort?
Heapsort is a comparison-based sorting algorithm that sorts an array in place by building a heap data structure and extracting elements in order.
How does heapsort work?
Heapsort works by first organizing the data into a binary heap. The largest element is placed at the root. Then it repeatedly extracts the root and places it at the end of the sorted array. With each extraction, the heap property is restored.
What is the worst case runtime complexity of heapsort?
O(nlogn)