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 are the non linear data structure?
What is the difference between for and foreach loop?
What is data structure and why we need them?
What is difference between hashmap and treemap?
Can a binary tree be empty?
What is a queue in data structure?
How will you reverse Linked List.
Which sorting is stable?
What is circular queue example?
What is java priority queue?
Explain what is the bucket size, when the overlapping and collision occur at same time?
Which algorithm is used in collections sort method?
Are sets sorted?
Is radix sort stable?
Why is bubble sort stable?