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
Can array store heterogeneous data?
What are the applications of priority queues?
Why do we use dynamic arrays?
How many types of lists are there?
Why hashmap is faster than hashset?
What is a minimum spanning tree?
Define shortest path?
What is mean by selection sort?
What is stable sort example?
What is stack algorithm?
What is difference between hashtable and hashmap?
We know that Arrays are objects so why cannot we write strArray.length()?
What is rule regarding overriding equals and hascode method?
What is a map in programming?
Can arraylist contain null?