Which sorting algorithm is generally considered more efficient for small datasets?
They have the same efficiency
Selection Sort
Bubble Sort
It depends on the data distribution
How does Insertion Sort build the sorted portion of the array?
By comparing and swapping adjacent elements
By finding the minimum element and placing it at the beginning
By iteratively expanding a sorted subarray from left to right
By recursively dividing the array into halves
In what real-world scenario might you encounter the need for a sorting algorithm?
Compressing an image file to reduce its size.
Encrypting a message for secure communication.
Generating random numbers within a specified range.
Displaying search results in order of relevance.
Bubble sort performs better than selection sort in which scenario?
Bubble sort never outperforms Selection sort
When the input array is randomly ordered.
When the input array is reversely sorted.
When the input array is already sorted.
What does it mean for a sorting algorithm to be 'in-place'?
It is the fastest possible sorting algorithm for a given data set.
It sorts the data in its original location without moving elements.
It can sort data of any type, including numbers, text, and images.
It sorts the data without requiring significant additional storage space.
What is the space complexity of Bubble Sort in its standard form?
O(log n)
O(n^2)
O(1)
O(n)
Insertion Sort can be considered an incremental algorithm. What does this mean?
It performs better on smaller datasets
It requires the entire dataset to be present in memory
It can handle data arriving in a continuous stream
It divides the problem into smaller subproblems
Which of the following is a real-world analogy for how Insertion Sort works?
Shuffling a deck of cards
Arranging cards in a hand by suit and rank
Searching for a specific webpage on the internet
Finding a book in a library by its Dewey Decimal number
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.
Finding the median of a dataset.
Compressing files for storage efficiency.
What is the best-case time complexity of Insertion Sort?
O(n log n)