Which sorting algorithm is generally considered more efficient for small datasets?
It depends on the data distribution
They have the same efficiency
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
Which statement BEST describes the significance of understanding sorting algorithms?
It's primarily a theoretical concept with little practical relevance.
It enables developers to choose the most suitable algorithm for a given task based on efficiency and data characteristics.
All sorting algorithms perform equally well, so understanding them is unnecessary.
It's only essential for software engineers specializing in algorithm development.
Which of the following best describes the concept of 'stability' in sorting algorithms?
A stable sorting algorithm maintains the relative order of equal elements.
A stable sorting algorithm is resistant to errors in the input data.
A stable sorting algorithm always has the lowest time complexity.
A stable sorting algorithm uses a fixed amount of memory regardless of input size.
Which of these situations might make Bubble Sort a suitable choice?
Real-time applications where speed is critical
Sorting a very large dataset
Sorting data with a complex key structure
When the input array is almost sorted
What is the worst-case time complexity of Selection Sort?
O(n^2)
O(log n)
O(n)
O(n log n)
What is a key limitation of both Bubble Sort and Selection Sort?
They cannot handle arrays with duplicate elements
They are not stable sorting algorithms
They have a high space complexity
They are inefficient for large datasets
Which of the following is a real-world application of sorting in databases?
Natural language processing for text analysis.
Data compression for efficient storage.
Data encryption for enhanced security.
Query optimization for faster retrieval of results.
What is the best-case time complexity of Insertion Sort?
O(1)
Is Selection Sort a stable sorting algorithm?
Only in its optimized version
Stability is irrelevant for Selection Sort
No
Yes