In what real-world scenario might you encounter the need for a sorting algorithm?
Displaying search results in order of relevance.
Compressing an image file to reduce its size.
Generating random numbers within a specified range.
Encrypting a message for secure communication.
What is the worst-case space complexity of Insertion Sort?
O(n log n)
O(1)
O(n)
O(log n)
Which algorithm repeatedly finds the minimum element from the unsorted part and puts it at the beginning?
Selection Sort
Merge Sort
Bubble Sort
Quick Sort
Bubble sort performs better than selection sort in which scenario?
Bubble sort never outperforms Selection sort
When the input array is already sorted.
When the input array is randomly ordered.
When the input array is reversely sorted.
Sorting algorithms can be broadly classified into two categories. What are they?
Stable and Unstable
Recursive and Iterative
In-place and Out-of-place
Comparison-based and Non-comparison-based
What is the best-case time complexity of Insertion Sort?
O(n^2)
Why is understanding the time and space complexity of sorting algorithms crucial?
To estimate the efficiency and resource usage of an algorithm for different input sizes.
To convert between different sorting algorithms.
To predict the output of a sorting algorithm without actually executing it.
To determine the exact number of comparisons and swaps performed by an algorithm.
Which of the following sorting algorithms is categorized as NON-comparison based?
Insertion Sort
Radix Sort
What is the worst-case time complexity of Selection Sort?
What is the space complexity of Bubble Sort in its standard form?