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
When would you use a tuple?
Complete structure of hashmap, very detail description, along with the basic coding of the hashmap internal implementation.
Can you override methods of arraylist?
What is data structure definition?
How is the front of the queue calculated ?
Why merge sort is better than insertion sort?
How many passes does bubble sort need?
Define a Deque?
Can we store null in arraylist?
Differentiate file structure from storage structure?
What is the use of sorting the data?
Is list a data type?
How can a binary tree be represented using the rotation?
Is treemap synchronized?
What actions are performed when a function is called?