I think that we can do it by first passing through an array once and convert
all the interger to the base N in O(N). Since all elements are in the range
1 to N^2 they can have atmost 3 digits.Now apply radix sort which will be O(
dn )  where d=3 in this case .=> O(n) when done convert them back to decimal
notation in O(N) .
But here N must be maximum no of single digit characters representable in ur
system.

Check if possible !!!!


On Tue, Aug 2, 2011 at 1:02 PM, payel roy <[email protected]> wrote:

> Can you please elaborate ??
>
>
> On 2 August 2011 12:38, sunny agrawal <[email protected]> wrote:
>
>> Radix sort is one of the solution.
>> because this Question is in the section Radix sort in CLRS. :)
>>
>>
>> On Tue, Aug 2, 2011 at 11:10 AM, Ravinder Kumar <[email protected]>wrote:
>>
>>> I have little thought on this :
>>>
>>> divide the whole array by n and store their remainder also in an array
>>> now number in original array are in range 1-n
>>> sort the array and when two number with same break the tie using
>>> remainder array
>>> recreate the array using remainder array .
>>> --
>>> *With Regards :*
>>>
>>> Ravinder Kumar
>>> B.Tech Final Year
>>> Computer Science and Engineering
>>> MNNIT Allahabad
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Sunny Aggrawal
>> B-Tech IV year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

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

Reply via email to