Skip to content

Commit 85f428e

Browse files
Ankush263github-actions
and
github-actions
authored
merge: Add test case to Interpolation Search Algorithm (#1045)
* Add test case to Interpolation Search Algorithm * Updated Documentation in README.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent 59760f7 commit 85f428e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { interpolationSearch } from '../InterpolationSearch'
2+
3+
test('interpolationSearch([2, 6, 8, 14, 122, 169], 144) => -1', () => {
4+
const array = [2, 6, 8, 14, 122, 169]
5+
const key = 144
6+
const res = interpolationSearch(array, key)
7+
expect(res).toEqual(-1)
8+
})
9+
10+
test('interpolationSearch([2, 6, 8, 14, 122, 169], 122) => 4', () => {
11+
const array = [2, 6, 8, 14, 122, 169]
12+
const key = 122
13+
const res = interpolationSearch(array, key)
14+
expect(res).toEqual(4)
15+
})

0 commit comments

Comments
 (0)