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


Please Help Members By Posting Answers For Below Questions

How do I start preparing for placement?

695


Why is an array homogeneous?

616


What are the drawbacks of array implementation of queue?

861


What is a hash index?

627


How expression trees are gets represented in data structure?

652


Is bubble sort adaptive?

660


Differentiate between an array and an arraylist.

763


What the principle of quick sort and its complexity?

731


Define a tree?

757


Define splay tree?

743


Is list same as array?

604


Write an algorithm through which the inserting and deleting of elements can take place in circular queue?

683


What are the advantages of bubble sort?

675


Is arraylist reference type?

620


What is difference between list set and map?

645