Tag: Time complexity O(log n)
-
Binary Search
Binary Search is a highly efficient algorithm for searching a sorted array or list. Unlike linear search, which checks each element one by one, binary search divides the problem in half with every iteration, making it logarithmic in nature. This reduces the time complexity significantly to O(log n), making it ideal for large datasets. How…