upload to gh
This commit is contained in:
parent
d9d8d06b8a
commit
f2407a9587
33 changed files with 941 additions and 83 deletions
16
src/day1/BTInOrder.ts
Normal file
16
src/day1/BTInOrder.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function walk(curr:BinaryNode<number> | null, path:number[]): number[]{
|
||||
//Base Case
|
||||
if(!curr){
|
||||
return path;
|
||||
}
|
||||
//Recurse
|
||||
walk(curr.left, path);
|
||||
path.push(curr.value);
|
||||
walk(curr.right, path);
|
||||
//Post
|
||||
return path;
|
||||
}
|
||||
|
||||
export default function in_order_search(head: BinaryNode<number>): number[] {
|
||||
return walk(head,[]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue