Skip to content

Commit 75e1025

Browse files
authored
Update Interpolation-Search.md
1 parent 0d08906 commit 75e1025

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dsa-solutions/Searching-Algorithms/Interpolation-Search.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Interpolation Search is an efficient search algorithm for uniformly distributed
2323
1. Initialize the low and high indices to 0 and N-1, respectively.
2424
2. While the target value is within the range defined by the current low and high indices:
2525
- Calculate the probe position using the formula:
26-
$$
27-
\text{pos} = \text{low} + \left( \frac{(x - \text{arr}[low]) \times (\text{high} - \text{low})}{\text{arr}[high] - \text{arr}[low]} \right)
28-
$$
26+
$$
27+
\text{pos} = \text{low} + \left( \frac{(x - \text{arr}[low]) \times (\text{high} - \text{low})}{\text{arr}[high] - \text{arr}[low]} \right)
28+
$$
2929
3. Check the value at the probe position:
3030
- If `arr[pos]` is equal to the target value, return `pos`.
3131
- If `arr[pos]` is less than the target value, update `low` to `pos + 1`.

0 commit comments

Comments
 (0)