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.
Fill in the blank: The ______ algorithm is often used for sorting integers and is based on the digits of the numbers.
Radix.
What is the worst-case time complexity of Selection Sort?
O(n^2).
Which sorting algorithm works by repeatedly finding the minimum element from the unsorted part?
Selection Sort.
True or False: Merge Sort works by recursively dividing the array in half until each sub-array has one element.
True.
What is the worst-case time complexity of Heap Sort?
O(n log n).
What is the key characteristic of Insertion Sort?
It builds a sorted array one item at a time.
Fill in the blank: The ______ algorithm is particularly efficient for data that is already partially sorted.
Insertion.
Which sorting algorithm is not suitable for large datasets due to its O(n^2) time complexity?
Bubble Sort.
True or False: Quick Sort is always the best choice for sorting.
False.
What is the average case time complexity of Bubble Sort?
O(n^2).
Which sorting algorithm is based on the concept of partitioning?
Quick Sort.
Fill in the blank: The ______ Sort algorithm can be implemented in a recursive or iterative manner.
Merge.
What is the main disadvantage of using Bubble Sort?
It is inefficient on large lists.
Which sorting algorithm is best suited for linked lists?
Merge Sort.
True or False: The efficiency of a sorting algorithm can depend on the initial order of the data.
True.
What is the space complexity of Quick Sort in the average case?
O(log n).
Fill in the blank: The ______ Sort algorithm is often used when the range of input values is known and small.
Counting.
What is the primary disadvantage of using Merge Sort?
It requires additional space for the temporary arrays.
What is the best-case time complexity of Quick Sort?
O(n log n).
Which sorting algorithm is used by Python’s built-in sort function?
Tim Sort.
True or False: Counting Sort is a comparison-based sorting algorithm.
False.
What is the time complexity of Tim Sort in the worst case?
O(n log n).
Fill in the blank: The ______ Sort algorithm is based on the idea of placing elements in their correct position.
Insertion.
Which sorting algorithm is particularly useful for sorting strings?
Radix Sort.
What is the fundamental operation of all comparison-based sorting algorithms?
Comparing elements.
True or False: All sorting algorithms have the same time complexity.
False.
What is the time complexity of Radix Sort?
O(nk), where k is the number of digits in the largest number.
Fill in the blank: The ______ algorithm is a non-comparative sorting algorithm that sorts data with integer keys.
Counting.
Which sorting algorithm is often considered the simplest to understand?
Bubble Sort.
What is the main advantage of using Tim Sort?
It is efficient for real-world data and takes advantage of existing order.