Question
Counting Sort is an efficient sorting algorithm when the
range of input elements (k) is not significantly larger than the number of elements (n). What is its time complexity?Solution
Counting Sort works by counting the frequency of each distinct element in the input array. It then uses this count information to place elements in their correct sorted positions. The time complexity involves iterating through the input array (O(N)) and iterating through the count array (which depends on the range K), making its overall time complexity O(N + K).

A trader purchased 132 dozens of mangoes at Rs.475 per dozen and could sell only 125 dozens at Rs.530 per dozen. What is the value of stock of mangoes i...
Economy of a bowler after (0.5n – 6) overs is 6. In the next six overs, he conceded 12, 9, 18, 7, 20 and 10, and his economy increases by 2. Find the ...

In a class of 60 students, 60% are boys. If 25% of the girls come to school by bicycle, find the number of girls who don't come cycling to school?
The daily wages of A and B respectively are Rs.3.50 and 2.50. When A finishes a certain work, he gets a total wage of Rs. 63. When B does the same work,...
If '+' means '-', '-' means '+', '×' means '÷', and '÷' means '×', then the value of 42 – 12 × 3 + 8 ÷ 2 + ...
The greater of the two numbers whose product is 900 and sum exceeds their difference by 30 is
Which of the following is the correct order?
A water tap fills a tub in 'p' hours and a sink at the bottom empties it in 'q' hours. If p < q and both tap and sink are open, the tank is filled in...