thanks:)
On Sat, Sep 10, 2011 at 6:58 PM, praveen raj <[email protected]> wrote:
> @rashmi..
> just sort the set in O(nlogn)....
> then use two pointers ... one from first end and another from second
> end....given below...in O(n)..
> i=0;
> j=n-1;
> while(i<j)
> {
> if((a[i]+a[j])==x)
> { printf("%d%d",a[i],a[j]);
> break;}
> if((a[i]+a[j])>x)
> j--;
> else
> i++;
> }
>
> do it with example...
>
> running time...O(nlogn)...
> With regards,
>
> Praveen Raj
> DCE-IT 3rd yr
> 9999735993
> [email protected]
>
> --
> 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.
>
--
*****
RASHMI JAIN
3rd Year,B.E.(IT)
Delhi technological University
*
--
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.