On Jun 30, 3:38 am, Debajyoti Sarma <sarma.debajy...@gmail.com> wrote:
> @Gene
> your code's last 3 line gives doubt.
>  .......
>  for (i = j = 0; j < M; j++)
>    while (c[j]--)
>      a[i++] = j;
> .......
> Is it don't make the complexity more than O(n) ??

Not at all. The inner loop body executes n times no matter what the
value of M is.

Guys, this is just a special case of counting sort.  Obviously O(n).

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to