International Journal of Computer Applications |
Foundation of Computer Science (FCS), NY, USA |
Volume 178 - Number 15 |
Year of Publication: 2019 |
Authors: Ashar Mehmood |
10.5120/ijca2019918788 |
Ashar Mehmood . ASH Search: Binary Search Optimization. International Journal of Computer Applications. 178, 15 ( May 2019), 10-17. DOI=10.5120/ijca2019918788
The binary search is a method of finding the position of an element in an ordered array. It continuously aims the middle element of array and check if it is the target element or not untills it finds its position. The best case complexity of binary search is O(1), whereas average and worst case time complexity is O(log n), where ‘n’ is the number of elements in the array. In this paper, I have proposed an algorithm which drastically improves the complexity of search algorithm in sorted array domain outperforming binary search, the paper also compares the proposed solution with other well-known search algorithms. The presented approach minimizes the space complexity, eliminates the need to analyze the scenario and look for the algorithm that best fits the given problem. The proposed algorithm has constant space complexity (O(1)) and time complexity of O(1) (constant time) in best case, O(log(log n)) in average case and O(log(n)) in worst case. Thus, most of the time proposed algorithm works very well as compared to other search algorithms in sorted array domain.