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 does abstract data type mean?
Can treeset have duplicates?
What is difference between set and map?
Design a datastructure to represent the movement of a knight on a chess board
Is stack a dynamic data structure?
What is top in stack?
What is data and its type?
Define b-tree of order m?
Describe linear probing with an example.
What are the properties of an algorithm?
What is significance of ” * ” ?
Why hashmap is faster than hashtable?
What is sorting with example?
What are priority queues?
Define terminal nodes in a tree?