feat: working through all the algos i'll need
This commit is contained in:
parent
7101b99c35
commit
6f41e5760d
5 changed files with 264 additions and 27 deletions
13
src/__tests__/BinarySearchArray.ts
Normal file
13
src/__tests__/BinarySearchArray.ts
Normal 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
5
src/global.d.ts
vendored
|
|
@ -1,3 +1,8 @@
|
|||
declare type Point = {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
declare interface List<T> {
|
||||
get length(): number;
|
||||
removeAt(index: number): T | undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue