• retagged by
716 views
2 2 votes

An array ‘A’ of length n contains numbers {0, 1, 2}, numbers are present in array in arbitrary order.

The best sorting algorithms, takes 250 units of time when n = 100. If n = 450. The minimum time required by algorithm on same hardware __________ (Rounded off to integers).

1 Answer

Best answer
1 1 vote
The best sort for this is counting sort, which has a time complexity of O(n). As the range is significantly less than the number of inputs.

For 100 inputs => 250 seconds.

Then for 450 inputs => 2.5 x 450 = 1125.
• selected by
Position:
Show:

Related questions

0 0 votes
1 answers 1 answer
2.0k
2.0k views
anon1 asked Jan 15, 2022
1,991 views
Can anyone explain each option, for every option if it is true then why? If false then why? (Please don’t comment like answer is A,B etc) Please helpWhich of the followin...
0 0 votes
1 1 answer
1.6k
1.6k views
GateAspirant999 asked Sep 16, 2018
1,573 views
Consider the following sorting algorithmSorting (A, low, high)Iif (low == high) return;if (low $+1==$ high)Iif $(\mathrm{A}[$ low $]>\mathrm{A}[$ high $])$swap (A[low], A...
0 0 votes
3 3 answers
2.7k
2.7k views
Deepalitrapti asked Sep 12, 2018
2,681 views
14Computer Science \& ITAlgorithm, DataQ. 78 Given a sorted array of n-elements where other than one element $x$ every other element repeat two times. Then how much time ...
1 1 vote
2 answers 2 answers
1.3k
1.3k views
Ravi Dubey asked Aug 2, 2018
1,305 views
Could a binary search tree be built using o(n lg n) comparisons in the comparisonmodel? Explain why or why not.