Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   get maximum x of array of points (http://www.go4expert.com/forums/maximum-x-array-t6811/)

nicromonicon 13Oct2007 17:25

get maximum x of array of points
 
Hey guys..so I have this array of points
Point[] arr = { new Point(0, 2),
new Point(1,0), new Point(3,0),
new Point(4,2), new Point(3,3) };
how can I determine the maximum X coordinate using order logn ?

shabbir 13Oct2007 18:08

Re: get maximum x of array of points
 
Just compare the X position.

nicromonicon 13Oct2007 18:24

Re: get maximum x of array of points
 
that would be linear search..order N
i want it logn

DaWei 13Oct2007 19:03

Re: get maximum x of array of points
 
Heap sort will give you n log n.


All times are GMT +5.5. The time now is 22:43.