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 / ahan

The binary search is faster than the sequential search.The
complexity of binary search is 'log n' where as the
complexity of sequential search is 'n'.Since each time we
are proceeding we have to deal with only half of the
elements of the array than the previous one.So we can easily
get a number from an array of elements through binary search
than sequential search.

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is vector a collection?

465


What are the types of collection?

476


What is difference between array and string?

532


Is arraylist fail fast?

498


Write the postfix form of the expression: (a + b) * (c - d)

606






What is m way tree in data structure?

629


Tell me why can't constant values be used to define an array's initial size

532


What is comparable interface?

544


What is a minimum spanning tree?

558


What is time complexity of hashmap?

532


What is harvesting in agriculture?

503


Write a program using mergesort technique.

544


Can arraylist store objects?

459


Is null a binary search tree?

484


How dynamic arrays are created?

482