BINARY SEARCH VISUALIZER

Binary Search Algorithm Steps:

Binary Search is an efficient algorithm for finding the position of a target element in a sorted array or list. It works by repeatedly dividing the search space in half, making it much faster than a linear search for large datasets.

Step 1: Initialize Pointers
Set two pointers, low and high, to represent the current range of the array you're searching. low starts at the beginning (index 0) and high starts at the end (last index).

Step 2: Find the Middle Element
Calculate the middle index mid: [mid = (low + high) / 2]

The element at index mid is the current middle element.

Step 3: Compare the Middle Element with the Target

Step 4: Repeat
Repeat steps 2 and 3 until low exceeds high, which means the target is not in the array.