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

What is quick sort example?

482


How would you reverse the characters of an array?

531


Is bucket sort a comparison sort?

487


How many types of lists are there?

524


How do you declare An array of three char pointers

516






What is bubble sort used for?

460


Define linked list data structure.

580


Write the c program to insert a node in circular singly list at the beginning.

504


How many types of linked list are there?

479


What is a queue in data structure?

533


Name few collections map implementations?

522


What is time complexity of hashmap?

526


Can arraylist hold different types?

480


What is the purpose of thread?

509


What is peep stack?

589