diff --git a/DIRECTORY.md b/DIRECTORY.md index df10ce16c0..315810f062 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -142,6 +142,7 @@ * [BinaryExponentiationRecursive](Maths/BinaryExponentiationRecursive.js) * [BisectionMethod](Maths/BisectionMethod.js) * [CheckKishnamurthyNumber](Maths/CheckKishnamurthyNumber.js) + * [CollatzSequence](Maths/CollatzSequence.js) * [Coordinate](Maths/Coordinate.js) * [CoPrimeCheck](Maths/CoPrimeCheck.js) * [DecimalExpansion](Maths/DecimalExpansion.js) @@ -159,6 +160,7 @@ * [FigurateNumber](Maths/FigurateNumber.js) * [FindHcf](Maths/FindHcf.js) * [FindLcm](Maths/FindLcm.js) + * [FindMaxRecursion](Maths/FindMaxRecursion.js) * [FindMin](Maths/FindMin.js) * [FindMinIterator](Maths/FindMinIterator.js) * [GetEuclidGCD](Maths/GetEuclidGCD.js) @@ -166,6 +168,7 @@ * [IsDivisible](Maths/IsDivisible.js) * [IsEven](Maths/IsEven.js) * [IsOdd](Maths/IsOdd.js) + * [IsPronic](Maths/IsPronic.js) * [LeapYear](Maths/LeapYear.js) * [LinearSieve](Maths/LinearSieve.js) * [LucasSeries](Maths/LucasSeries.js) @@ -197,6 +200,7 @@ * [SquareRoot](Maths/SquareRoot.js) * [SumOfDigits](Maths/SumOfDigits.js) * [SumOfGeometricProgression](Maths/SumOfGeometricProgression.js) + * [TwinPrime](Maths/TwinPrime.js) * [Volume](Maths/Volume.js) * [WhileLoopFactorial](Maths/WhileLoopFactorial.js) * [ZellersCongruenceAlgorithm](Maths/ZellersCongruenceAlgorithm.js) diff --git a/Search/test/InterpolationSearch.test.js b/Search/test/InterpolationSearch.test.js new file mode 100644 index 0000000000..744a74855b --- /dev/null +++ b/Search/test/InterpolationSearch.test.js @@ -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) +})