Which one is faster?
A binary search of an orderd set of elements in an array
or
a sequential search of the elements.
Answer Posted / nishant singh
Binary search is faster because we traverse the elements by
using the policy of Divide and Conquer.
we compare the key element with the approximately center
element, if it is smaller than it search is applied in the
smaller elements only otherwise the search is applied in the
larger set of elements.
its complexity is as we all know is log n as compared to the
sequential one whose complexity is n.
| Is This Answer Correct ? | 30 Yes | 1 No |
Post New Answer View All Answers
What is the difference between length () and size () of arraylist?
What is the complexity of arraylist?
What are the disadvantages of using collection classes over arrays?
Which is faster list or set?
What do you mean by sorting?
How do I push an element into a stack?
What is frozenset?
Briefly explain recursive algorithm 50 how do you search for a target key in a linked list?
What is scalar data type?
What are the different types of hash functions?
What is difference between array and string?
Why is data structure used?
What is the difference between adt and data structure?
What is bubble sort?
What is the difference between hashset and hashtable?