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 / ujjwal dave

binary search is faster and more useful in case we need to
perform search a number of times, complexity of sequential
search will be n each time where in binary search will take
more time only at first time when data is not sorted once
the data is sorted......it will take only only log n
attempts to search each element.......so the decision also
depends on frequency of the data beign searched

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the tasks performed during preorder traversal?

790


How to reverse a singly linked list?

719


What is the use of data structure in real life?

706


What is difference between list and array?

639


In what areas do data structures are applied?

719


What are the advantages of merge sort?

625


How do you sort large data?

734


Briefly explain recursive algorithm 50 how do you search for a target key in a linked list?

735


List all data structures you would use for a memory management module.

736


How would you reverse the characters of an array?

700


Which is faster hashmap or hashtable?

691


How is heap sort implemented?

636


Tell me do array subscripts always start with zero?

672


What is the function of stack?

623


Can we add duplicate keys in a hashmap? What will happen if we attempt to add duplicate values?

628