CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2013
    Posts
    1

    Post Linear& Binary Search

    Hi there,
    Can I know what are the similarities of Linear search & Binary search techniques?
    Thank you.....

  2. #2
    Join Date
    Jul 2013
    Posts
    576

    Re: Linear& Binary Search

    Quote Originally Posted by Cruger View Post
    Can I know what are the similarities of Linear search & Binary search techniques?
    The only similarity is that both are used for searching.

    Key to the binary search is that data must be sorted. It allows a search to take place by successive halving resulting in a time complexity of O(log N) which is much faster than the O(N) of a linear search.

  3. #3
    Join Date
    Nov 2013
    Posts
    1

    Re: Linear& Binary Search

    Hi, exuse me, I am Belarusian men and my English very bad, but if you know about sort of list, please say about it.

  4. #4
    Join Date
    Jul 2013
    Posts
    576

    Re: Linear& Binary Search

    Quote Originally Posted by Pavelx4y16 View Post
    Hi, exuse me, I am Belarusian men and my English very bad, but if you know about sort of list, please say about it.
    The quick and dirty way is to convert the list into an array which is then sorted using a standard array sorting algorithm. Then a new list is built from the sorted array and the old list is deleted.

    This is for example how the Java standard library does it.

Tags for this Thread

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