Question

counting Sort(A[1 ...n]): // assume each A[i] € {1,2,...,k} 1: for v :=1 to k: 2: count[v] := 0 3: for i:=1 to n: 4: count[A[

In terms of n, what is the worst-case running time of countingSort on an input array of n letters from the alphabet (so k = 26, and n is arbitrary)?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Please upvote the answer if you find it useful and comment down below for any queries.

The worst-case running time of countingSort is = O(n) because ultimately the inner loop will execute n times and k being a constant does not impact the time complexity.

Add a comment
Know the answer?
Add Answer to:
In terms of n, what is the worst-case running time of countingSort on an input array...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT