Re: Linear& Binary Search
Quote:
Originally Posted by
Cruger
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.
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.
Re: Linear& Binary Search
Quote:
Originally Posted by
Pavelx4y16
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.