get maximum x of array of points

Discussion in 'C#' started by nicromonicon, Oct 13, 2007.

  1. nicromonicon

    nicromonicon New Member

    Joined:
    Oct 13, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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 ?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,336
    Likes Received:
    377
    Trophy Points:
    83
    Just compare the X position.
     
  3. nicromonicon

    nicromonicon New Member

    Joined:
    Oct 13, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    that would be linear search..order N
    i want it logn
     
  4. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    Heap sort will give you n log n.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice