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
Does arraylist guarantee insertion order?
How to excel in data structures and algorithms?
Which interface provides the capability to store objects using a key-value pair?
Is tuple immutable?
Can we insert null in hashset?
If you are using c language to implement the heterogeneous linked list, explain what pointer type will you use?
What does args stand for?
Which sorting algorithm is the slowest?
Write a Program for Insert in a sorted list
Will it create any problem if we add elements with key as user defined object into the treemap?
What is an algorithm in coding?
How does a treemap sort?
Which is the simplest file structure? (a) Sequential (b) Indexed (c) Random (a) Sequential
Why is an array homogeneous?
Can we remove element from arraylist while iterating?