feat: working through all the algos i'll need

This commit is contained in:
mpaulson 2022-07-18 21:54:39 -06:00
parent 7101b99c35
commit 6f41e5760d
5 changed files with 264 additions and 27 deletions

View file

@ -0,0 +1,13 @@
import binary_fn from "@code/binary_search_array"
test("binary search array", function() {
const foo = [1, 3, 4, 69, 71, 81, 90, 99, 420, 1337, 69420];
expect(binary_fn(foo, 69)).toEqual(true);
expect(binary_fn(foo, 1336)).toEqual(false);
expect(binary_fn(foo, 69420)).toEqual(true);
expect(binary_fn(foo, 69421)).toEqual(false);
expect(binary_fn(foo, 1)).toEqual(true);
expect(binary_fn(foo, 0)).toEqual(false);
});

5
src/global.d.ts vendored
View file

@ -1,3 +1,8 @@
declare type Point = {
x: number;
y: number;
}
declare interface List<T> {
get length(): number;
removeAt(index: number): T | undefined;