answersLogoWhite

0


Best Answer

Linear search takes linear time with a worst case of O(n) for n items, and an average of O(n/2). Binary search takes logarithmic time, with a worst and average case of O(n log n). Binary search is therefore faster on average.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

Sequential search has a worst case of O(n) for n elements and an average of O(n/2). Binary search with a perfectly balanced binary tree or a sorted array takes O(n log n) time, both in the worst case and on average. However, an unbalanced tree has a worst case of O(n) when the tree is constructed from data that is already sorted or is in reverse order. So it is not true that a binary search algorithm is always faster, it is only faster when the structure is balanced and preferably perfectly balanced. Sorted arrays can always be regarded as being balanced but not necessarily perfectly balanced. A perfectly balanced tree has n levels such that the entire tree has 2^n-1 elements {0, 1, 3, 7, 15, 31, 63, ...} as defined by OEIS sequence A000225.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

A binary search is typically faster than a sequential search but requires that the data is sorted. Binary search has logarithmic time complexity whereas sequential search has linear time complexity.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Binary search is, on average, much quicker than a linear search. Whereas a linear search must traverse the entire list or array in sequence to locate a matching element, binary trees search via a divide-and-conquer algorithm. If the tree is balanced, then half the list is automatically eliminated at each depth of the search, thus minimising the number of comparisons required overall. While a linear search may require fewer comparisons when the element is near the start of the list, elements towards the end of the list will require a good deal more comparisons. In terms of complexity, a linear search of n elements is O(1) for the first element, O(n) for the last and O(n/2) on average, whereas a binary tree has an average of O(n log n) if the tree is balanced.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

In sequential search, you have to check each element in the list one after another, with a worst case efficiency of O(n).

If you use binary search the list must be sorted), you are essentially cutting the remaining elements you must search in half with an efficiency of O(log n).

For example, searching for 9:

Sequential: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Binary: start at 4, 9 is higher you have 5 - 9 to the right. You check halfway through that "list", you see that 9 is larger than 7, so go right, repeat.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

The advantage of a binary search over a linear search is astounding for large numbers. For an array of a million elements, binary search, O(log N), will find the target element with a worst case of only 20 comparisons. Linear search, O(N), on average will take 500,000 comparisons to find the element.

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

Binary search is more efficient than linear search because we perform fewer comparisons on average. With linear search we can only eliminate one element per comparison each time we fail to find the value we are looking for, but with binary search we eliminate half the set with each comparison. For a set of n elements, the worst case is O(n) comparisons for a linear search and O(log n) comparisons for a binary search. Although there will be fringe cases where a linear search is quicker (such as when the set is particularly small or the values we seek are at or near the beginning of the sequence), we have to look at the worst case.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

yes alaways as.....this works on time o(logn).but sequential searches alaways works on complexity o(n^2).....so...it is faster

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

yes, but it requires that the data be entered originally in a searchable tree format.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Advantages of binary search over sequencial search?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the advantages to using Google web search over other search engines?

There can be different advantages in using Google web search over others. Some people find it to be faster and have more information than the other sites.


What advantages does Travel Zoo Super Search offer over other travel sites?

By using Travel Zoo Super Search offers the advantages of deals on flights, hotels and holiday packages. They can also search for cruises and local activities to book.


Advantages of binary over decimal you?

The addition and multiplication table is much simpler. Also, on a computer it is easier to distinguish two different states than ten different states. For these reasons, modern computers do most of their calculations internally in binary.


What are the advantages of the binary one quaternary 2B1Q over Alternate Mark Inversion AMI signaling schems?

It is less expensive It is available from any NT1 vedor It can support signal over twice the distance


What is the advantages of binary digits over the decimal?

Computers do not understand decimal notation. All information (both instructions and data) must be converted to a binary representation before the machine can understand it. We use the symbols 0 and 1 (binary notation) but the machine has a variety of physical representations it can use to encode binary data, including transistors, flux transitions, on/off switches and so on.


What happens to binary numbers over 255?

You simply use more binary digits.


When was The Search Is Over created?

The Search Is Over was created in 1985.


What are advantages of hartnell over porter governor?

advantages of hartnell governor over porter governor


What are the advantages of a word-processed document?

writethe advantages of word processing over conventional method


What advantages do corporations have over small businesses?

List two advantages that corporation have over a small business


Application of binary tree in data structure?

1) the complexity of insertion,deletion and searching operation is depend on the height of the tree. i.e. if height is n(for skew binary tree) then complexity is O(n) . 2) difficult to get the sorted list from the binary tree.which is easy for BST.


What advantages does the iPod Nano have over the iPod Touch?

No advantages whatsoever...