Preorder tells you which node is the root. Inorder tells you which nodes go to its left and which go to its right. Take one root at a time, split the arrays, and recurse. With a hashmap and a pointer
Algorithms, AI Engineering, Full Stack Systems
Code got cheap. Being right didn’t. Writing about AI engineering, distributed systems, algorithms, and product.
Markdown supported · ⌘↵ to post
No responses yet.