What is a key limitation of counting sort?
It cannot sort datasets containing duplicate values.
Its space complexity can be significant if the range of input values is large.
It is only efficient for datasets with an even number of elements.
It is not suitable for sorting strings or objects.
Counting sort is often used as a subroutine in which other sorting algorithm?
Merge Sort
Heap Sort
Radix Sort
Quick Sort
Is counting sort inherently stable?
No, counting sort is inherently unstable.
Yes, counting sort is always stable.
The stability of counting sort depends on the input data.
Counting sort can be made stable with modifications to the algorithm.
Is Merge Sort an in-place sorting algorithm?
No
Yes
In the context of Heap Sort, what is the process called where we ensure that a subtree maintains the heap property?
Heap-balance
Sift-down
Heapify
Sift-up
What is the space complexity of Quick Sort in the average and worst case scenarios?
O(n) in the average case and O(log n) in the worst case
O(log n) in the average case and O(n) in the worst case
O(n) in both average and worst cases
O(1) in both average and worst cases
Why is Quick Sort often preferred over Merge Sort in practice, despite having the same average-case time complexity?
Quick Sort is an in-place sorting algorithm, while Merge Sort requires additional space for merging
Quick Sort has a lower constant factor in its time complexity, making it faster for smaller datasets
Quick Sort is more memory-efficient due to its recursive nature
Quick Sort is easier to parallelize and implement on multi-core processors
How does the space complexity of Heap Sort compare to other comparison-based sorting algorithms?
Heap Sort has a lower space complexity
Heap Sort has a higher space complexity
Heap Sort typically has the same space complexity
Heap Sort's space complexity depends on the input data
What is a potential limitation of Heap Sort compared to some other efficient sorting algorithms?
Its average-case time complexity is worse than some other algorithms.
It is less efficient when the input data is already nearly sorted.
It requires the entire dataset to be in memory.
It is not well-suited for sorting linked lists.
What is the primary purpose of topological sorting in the context of graph algorithms?
To find the minimum spanning tree of a graph, connecting all nodes with the minimum total edge weight.
To find the shortest path between any two nodes in a weighted graph.
To determine if a graph contains any cycles.
To arrange the nodes of a directed acyclic graph (DAG) in a linear order such that for every directed edge (u, v), node u comes before node v in the ordering.