Which of the following is NOT a valid reason for using sorting algorithms?
Improving the performance of searching algorithms.
Presenting data in a user-friendly order.
Compressing files for storage efficiency.
Finding the median of a dataset.
What is the best-case time complexity of Insertion Sort?
O(1)
O(n)
O(n log n)
O(n^2)
Which of the following sorting algorithms has the best-case time complexity of O(n)?
Selection Sort
Bubble Sort
Neither Bubble Sort nor Selection Sort
Both Bubble Sort and Selection Sort
What is the worst-case space complexity of Insertion Sort?
O(log n)
Insertion Sort can be considered an incremental algorithm. What does this mean?
It performs better on smaller datasets
It can handle data arriving in a continuous stream
It divides the problem into smaller subproblems
It requires the entire dataset to be present in memory
What is a key limitation of both Bubble Sort and Selection Sort?
They are not stable sorting algorithms
They cannot handle arrays with duplicate elements
They have a high space complexity
They are inefficient for large datasets
What is the fundamental difference between comparison-based and non-comparison-based sorting algorithms?
Comparison-based algorithms are faster than non-comparison-based algorithms.
Comparison-based algorithms sort by comparing elements, while non-comparison-based algorithms exploit data properties for sorting.
Comparison-based algorithms are more memory efficient than non-comparison-based algorithms.
Comparison-based algorithms are used for numerical data, while non-comparison-based algorithms are used for text data.
Which of the following is a real-world analogy for how Insertion Sort works?
Searching for a specific webpage on the internet
Finding a book in a library by its Dewey Decimal number
Shuffling a deck of cards
Arranging cards in a hand by suit and rank
Which of these situations might make Bubble Sort a suitable choice?
Real-time applications where speed is critical
Sorting data with a complex key structure
Sorting a very large dataset
When the input array is almost sorted
Is Bubble Sort a stable sorting algorithm?
Yes
No
Only in its optimized version
Stability is irrelevant for Bubble Sort