CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    9

    Efficient min-max finder

    Hi experts,
    I have an array,I want to find the Min and Max value in a more efficient way than just itterating it,is there any way better?
    thanks.
    Last edited by Melvik12; January 24th, 2006 at 10:33 AM.

  2. #2
    Join Date
    Sep 2004
    Location
    Tehran(Ir)
    Posts
    469

    Re: Efficient min-max finder

    the best structure for finding min and max item in a collection is min-max heap,but seems you just have to use arrays,so you can make it more efficient by comparing pair elements with current min or max ,it would take o(n) but it is more efficient than checking elements one by one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured