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 are more memory efficient 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 used for numerical data, while non-comparison-based algorithms are used for text data.
What is the space complexity of Bubble Sort in its standard form?
O(n^2)
O(log n)
O(n)
O(1)
How does Insertion Sort build the sorted portion of the array?
By iteratively expanding a sorted subarray from left to right
By recursively dividing the array into halves
By comparing and swapping adjacent elements
By finding the minimum element and placing it at the beginning
Why are sorting algorithms considered fundamental in computer science?
They are primarily used for displaying data to the user.
They are the basis for more complex algorithms and data structures.
They are only used in specific niche applications.
They are rarely used in modern software development.
Bubble sort performs better than selection sort in which scenario?
When the input array is already sorted.
Bubble sort never outperforms Selection sort
When the input array is randomly ordered.
When the input array is reversely sorted.
Why is Insertion Sort not preferred for large datasets?
It is not a stable sorting algorithm
It has a high space complexity
It is difficult to implement
Its time complexity is quadratic in the worst case
Which algorithm repeatedly finds the minimum element from the unsorted part and puts it at the beginning?
Quick Sort
Merge Sort
Selection Sort
Bubble Sort
In what real-world scenario might you encounter the need for a sorting algorithm?
Displaying search results in order of relevance.
Encrypting a message for secure communication.
Compressing an image file to reduce its size.
Generating random numbers within a specified range.
Which of the following sorting algorithms is categorized as NON-comparison based?
Radix Sort
Insertion Sort
What is the primary operation used in Insertion Sort to place an element in its correct position?
Comparison
Shifting
Swapping
Merging