@saurabh.....shouldn't be 5 also be in the output....i think u forgot to
print the root value

On Sat, Jul 9, 2011 at 9:27 PM, saurabh singh <[email protected]> wrote:

> code for my *second *solution
> http://www.ideone.com/oxDql
> <http://www.ideone.com/oxDql>Point out any bugs if you find.
>
>
> On Sat, Jul 9, 2011 at 12:43 PM, saurabh singh <[email protected]>wrote:
>
>>
>> Sort and take window of 2 while traversing,
>> stop when the elements in the window do not match.The first one will be
>> the non-repeated assuming only one such number exist in the array.
>> complexity:o(nlogn)
>>
>> PS:Another possible solution is =>
>> 1. Form a BST.Add extra variable count to the node.
>> 2.while inserting check if value already exists,if exist increment
>> count.Do not insert the duplicate value.
>> 3 perform any traversal to look for node with count field 1.
>>
>> I am not sure of the correctness or complexity of my latter
>> solution,Kindly ignore if it sounds crap,
>>  Saurabh Singh
>> B.Tech (Computer Science)
>> MNNIT ALLAHABAD
>>
>>
>>
>
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> 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.
>

-- 
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