You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Behaviour of interpolationSearch may be considered inconsistent.
For some arrays it will return the index of the first match - expect(interpolationSearch([1, 1], 1)).toBe(0) - while for others it returns the second or third one.
dubzzz
changed the title
BUG interpolationSearch may not return the first index with the value
interpolationSearch may not return the first index with the value
Feb 15, 2019
Details:
Behaviour of
interpolationSearch
may be considered inconsistent.For some arrays it will return the index of the first match -
expect(interpolationSearch([1, 1], 1)).toBe(0)
- while for others it returns the second or third one.Step to reproduce:
interpolationSearch([-1, 0, 0], 0))
Expected result:
1
Got:
2
How did I find it?
Thanks to property based testing framework fast-check.
The property was the following:
Or:
The text was updated successfully, but these errors were encountered: