File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
dsa-solutions/Searching-Algorithms Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,9 @@ Interpolation Search is an efficient search algorithm for uniformly distributed
23
23
1 . Initialize the low and high indices to 0 and N-1, respectively.
24
24
2 . While the target value is within the range defined by the current low and high indices:
25
25
- 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
+ $$
29
29
3 . Check the value at the probe position:
30
30
- If ` arr[pos] ` is equal to the target value, return ` pos ` .
31
31
- If ` arr[pos] ` is less than the target value, update ` low ` to ` pos + 1 ` .
You can’t perform that action at this time.
0 commit comments