Question: Suppose we have an algorithm A that does comparison-based sorting. Answer true or false for each of the following. Assume our input size is n,
Suppose we have an algorithm A that does comparison-based sorting. Answer true or false for each of the following. Assume our input size is n, and that each of the n inputs is distinct. 1. There can be an input ordering for which algorithm A executes no more than n comparisons to determine the sorted order. 2. There can be an input ordering for which algorithm A executes no more than 2n comparisons to determine the sorted order. 3. There a total of n! different input orderings. 4. There is at least one input ordering that requires (n lg n) comparisons to determine the sorted order
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
