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
What data type is enum?
What is best time complexity?
What is an algorithm in coding?
What is modcount in hashmap?
How to compare Two Arrays?
How are the elements of a 2d array are stored in the memory?
What is difference between capacity and size of arraylist?
What’s the difference between enumeration and iterator interfaces?
How do you empty an arraylist?
What is sorting and classifying?
Will hashmap allow null keys?
in tree construction which is the suitable efficient data structure? (Array, linked list, stack, queue)
Are the expressions arr and &arr same for an array of integers?
What are the issues that hamper the efficiency in sorting a file?
How do you define a set?