Sorting
closed

edited by
2,264 views
2 2 votes
closed with the note: Got it

Consider the following two statements:
P: There exists a comparison sort of 5 numbers that uses at most 6 comparisons in worst case.
Q: Heap sort can be used as the auxiliary sorting routine in radix sort, because it operates in-place

Choose appropriate option.

  1. P true, Q false
  2. Q true, P false
  3. Both P, Q are true
  4. Both P, Q are false

1 Answer

Best answer
0 0 votes

P is False because of the number of leaves of a decision tree which sort $5$ numbers is $5!$ and the height of a tree is atleast  $log(5!)$. We need atleast $7$ comparisons. 

Q is False because of auxiliary sorting routine in radix sort needs to be stable, meaning that numbers with the same value appear in the output array in the same order as they do appear in the input array. Heapsort is not stable. It does operate in place, meaning that only a constant number of elements of the input array are ever stored outside the array

selected by
Position:
Show:

Related questions

0 0 votes
2 2 answers
845
845 views
reena_kandari asked Jan 10, 2017
845 views
Consider the following two statementsP: There exists a comparison sort of 5 numbers that uses at most 6 comparisons in worst case.Q: Heap sort can be used as the auxiliar...
1 1 vote
2 2 answers
806
806 views
Pradeep Verma asked Jul 7, 2018
806 views
Q. 16 Consider a radix sort, which is used to sort the following 3 -bit binary numbers. 100, 001, 110, 011, 010 (in the given order) Here first binary number is 100 and l...
0 0 votes
1 1 answer
3.7k
3.7k views
pradeepchaudhary asked Jul 8, 2018
3,741 views
You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate?1)QuickSort2)MergeSort3)HeapSort4)Selection Sort...
0 0 votes
0 0 answers
942
942 views
Rahul Ranjan 1 asked Jun 15, 2018
942 views
You are asked to sort 15 randomly generated numbers. One should prefer - 1. Bubble Sort2. Quick Sort3. Merge Sort4. Heap Sort Please explain why others 3 sorting algorith...