answersLogoWhite

0


Best Answer

The primary advantage of a binary search algorithm is that searching a sequence can be achieved in logarithmic time. The primary disadvantages are that the data must be in sorted order. Arrays are the ideal container for binary searches as they provide constant-time random-access and are therefore trivial to both sort and search efficiently. Sorted binary trees can also be used, however for optimal performance they must be totally balanced (e.g., red/black binary tree). Constant-time random-access is not a requirement of binary trees, however the cost of maintaining balance during construction of the tree has to be taken into account.

With a linear search, we start at one end of the sequence and traverse through the sequence one element at a time until we find the value we're looking for, or we reach the element one-past-the-end of the sequence (in which case the element we're looking for does not exist). For a sequence of n elements, the worst case is O(n). Linear search is ideal for forward lists (singly-linked lists) and lists (doubly-linked lists) as neither provides nor requires constant-time random-access.

With binary search, we locate the middle element in the sequence. If that's not the value we are looking for, we can easily determine which half of the sequence contains our value because the elements are in sorted order. So we eliminate the other half and repeat the algorithm with the remaining half. As such, each failure to find the value reduces the number of elements to be searched by half (plus the middle element). If there are no elements in the remaining half then the value does not exist. The worst case is therefore O(log n).

User Avatar

Anya Kub

Lvl 10
2y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

the binary search algorithm works as access the middle element of list.this means that the list must be stored in some type of array, the problem occur when inserting an array require move down the elements of list and in case of deleting from an array moved up the elements of the list.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

searching can be used more time,

its have same level of leaf node , so memory can be waste

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the disadvantages of using a Binary Search?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you print all data in a Binary Search Tree?

By using Depth First Search or Breadth First search Tree traversal algorithm we can print data in Binary search tree.


How can one perform a binary search?

One can perform a binary search easily in many different ways. One can perform a binary search by using an algorithm specifically designed to test the input key value with the value of the middle element.


Which is faster binary tree or binary search tree?

A tree doesn't do anything so it has no speed...


What are the Advantages and disadvantages of using a Money Order?

search under your bed


What is binary search in data structure using c?

a tree which has atmost two nodes is called binary tree binary search tree is a binary tree which satisfies the following 1.every node in tree must be distinct 2.values in right subtree > value at root 3.values in left subtree < value at root 4.left,right subtrees must be binary search trees


What are the disadvantages and advantages of using blekko search engine?

blekko merits and demerits


What assumption about the list is made when binary search is conducted?

Binary search requires that the list be in search key order.


What are the advantages and disadvantages of searching in C programming?

If the data is sorted and every element is directly accessible, then you can perform binary search (see built-in function bsearch), otherwise you have to do linear search (which is slower).


What is the use of binary?

Binary trees are commonly used to implement binary search tree and binary heaps.


A binary search of an orderd set of elements in an array or a sequential search of the elements.Which one is faster?

A binary search is much faster.


What is the binary number for decimal 191?

It is 10111111 in binary. Try a search for '191 to binary'.


Items that are not suitable for a binary search?

The only items suitable for a binary search are those which are in a sorted order.