Which sorting algorithm is generally considered more efficient for small datasets?
They have the same efficiency
It depends on the data distribution
Bubble Sort
Selection Sort
Which of the following sorting algorithms has the best-case time complexity of O(n)?
Neither Bubble Sort nor Selection Sort
Both Bubble Sort and Selection Sort
What is the space complexity of Bubble Sort in its standard form?
O(log n)
O(1)
O(n^2)
O(n)
Is Bubble Sort a stable sorting algorithm?
Stability is irrelevant for Bubble Sort
Only in its optimized version
No
Yes
Sorting algorithms can be broadly classified into two categories. What are they?
Stable and Unstable
Recursive and Iterative
Comparison-based and Non-comparison-based
In-place and Out-of-place
Which of these characteristics is typically used to analyze and compare the efficiency of sorting algorithms?
Code readability, which refers to how easy the code is to understand.
The specific data values being sorted.
Time complexity, which measures the number of operations as data size grows.
Programming language used to implement the algorithm.
What is a key limitation of both Bubble Sort and Selection Sort?
They have a high space complexity
They are inefficient for large datasets
They cannot handle arrays with duplicate elements
They are not stable sorting algorithms
Which of the following is a real-world application of sorting in databases?
Natural language processing for text analysis.
Data encryption for enhanced security.
Data compression for efficient storage.
Query optimization for faster retrieval of results.
In what real-world scenario might you encounter the need for a sorting algorithm?
Compressing an image file to reduce its size.
Displaying search results in order of relevance.
Generating random numbers within a specified range.
Encrypting a message for secure communication.
What is the best-case time complexity of Insertion Sort?
O(n log n)