get maximum x of array of points

Newbie Member
13Oct2007,17:25   #1
nicromonicon's Avatar
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 ?
Go4Expert Founder
13Oct2007,18:08   #2
shabbir's Avatar
Just compare the X position.
Newbie Member
13Oct2007,18:24   #3
nicromonicon's Avatar
that would be linear search..order N
i want it logn
Team Leader
13Oct2007,19:03   #4
DaWei's Avatar
Heap sort will give you n log n.