1
0

Initial commit

This commit is contained in:
2025-12-16 20:39:11 +00:00
commit 8ae9352aa1
70 changed files with 3898 additions and 0 deletions

19
src/day1/BTPreOrder.ts Normal file
View File

@@ -0,0 +1,19 @@
function walk(curr: BinaryNode<number> | null, path: number[]): number[] {
if (!curr) {
return path;
}
// pre
path.push(curr.value);
// recurse
walk(curr.left, path);
walk(curr.right, path);
// post
return path;
}
export default function pre_order_search(head: BinaryNode<number>): number[] {
return walk(head, []);
}