Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Search/test/InterpolationSearch.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { interpolationSearch } from '../InterpolationSearch'

test('interpolationSearch([2, 6, 8, 14, 122, 169], 144) => -1', () => {
const array = [2, 6, 8, 14, 122, 169]
const key = 144
const res = interpolationSearch(array, key)
expect(res).toEqual(-1)
})

test('interpolationSearch([2, 6, 8, 14, 122, 169], 122) => 4', () => {
const array = [2, 6, 8, 14, 122, 169]
const key = 122
const res = interpolationSearch(array, key)
expect(res).toEqual(4)
})