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
How do I start preparing for placement?
Why is an array homogeneous?
What are the drawbacks of array implementation of queue?
What is a hash index?
How expression trees are gets represented in data structure?
Is bubble sort adaptive?
Differentiate between an array and an arraylist.
What the principle of quick sort and its complexity?
Define a tree?
Define splay tree?
Is list same as array?
Write an algorithm through which the inserting and deleting of elements can take place in circular queue?
What are the advantages of bubble sort?
Is arraylist reference type?
What is difference between list set and map?