good day everyone
i have a smart question and it is my homework i did not know how to start and what the ideas
Can you help ????


Write a linear-time algorithm that sorts n distinct integers, each of which is between 1 and
500. Hint: Use a 500-element array. (Linear-time means your algorithm runs in time c*n + b,
where c and b are any constants that do not depend on n. For example, your algorithm can run
in time n, or time 2n + 1, or time 5n + 10, or time 100n + 6, but not time c*n*n = c*n².)

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.