What are the differences between linear search and Binary search algorithm?
What are the differences between linear search and Binary search algorithm?
Answer:
Differences between linear search and Binary search algorithm:
Linear Search
|
Binary Search
|
1. Linear Search algorithm
finds the location LOC of the given ITEM of information in DATA array
inefficiently.
|
1. Binary Search algorithm finds the location LOC of the given ITEM
of information in DATA array efficiently.
|
2. Linear search algorithm compares ITEM with each element of DATA
one by one.
|
2. Binary search algorithm compare ITEM with middle element of data
one segment by one.
|
3. In Linear search algorithm ITEM is first assigned to DATA [N+1].
|
3. In Binary search algorithm ITEM is not assigned to DATA [N+1].
|
4. The complexity of linear search algorithm is O(n).
|
4. The complexity of Binary search algorithm is O(log₂n
|
5. In linear search algorithm data must not be shorted.
|
5. In Binary search algorithm data must be shorted.
|
No comments
Dear Members, Thanks for Your Comments. We must be reply your comment answer as soon as possible. Please Stay with us.....