group 4 Flashcards
What is the primary purpose of a sorting algorithm?
To arrange the elements of a list or array in a specific order.
True or False: Sorting algorithms only work with numeric data.
False.
What is the time complexity of the Bubble Sort algorithm in the worst case?
O(n^2).
Which sorting algorithm is known for its divide-and-conquer strategy?
Merge Sort.
Fill in the blank: The ______ Sort algorithm repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.
Bubble.
What is the average time complexity of Quick Sort?
O(n log n).
True or False: Insertion Sort is more efficient on small datasets than on large datasets.
True.
Which sorting algorithm is considered stable?
Merge Sort.
What is the best-case time complexity of Insertion Sort?
O(n).
Which algorithm has a worst-case time complexity of O(n log n) but can degrade to O(n^2)?
Quick Sort.
Fill in the blank: The ______ Sort algorithm divides the input list into two halves, sorts them, and then merges them back together.
Merge.
What is the space complexity of Merge Sort?
O(n).
True or False: Selection Sort is an in-place sorting algorithm.
True.
Which algorithm is often used as a hybrid sorting algorithm combining Insertion Sort and Merge Sort?
Tim Sort.
What is the main advantage of Heap Sort?
It has a guaranteed O(n log n) time complexity in all cases.
Fill in the blank: The ______ Sort algorithm builds a heap from the input data and then repeatedly extracts the maximum element.
Heap.
Which sorting algorithm is generally the fastest for large datasets?
Quick Sort.
What is a key feature of a stable sorting algorithm?
It maintains the relative order of records with equal keys.
True or False: Counting Sort can sort negative numbers.
False.
What type of algorithm is Radix Sort classified as?
Non-comparative sorting algorithm.