package
0.0.0-20241209140624-9fce2a725d55
Repository: https://github.com/elven9/my-leetcode.git
Documentation: pkg.go.dev
# README
Construct Binary Tree from Preorder and Inorder Traversal
Solution Idx | Time Complexity | Space Complexity | Comment |
---|---|---|---|
1 | Average: O(n * log(n)), Worst Case: O(n^2) | O(1) | Naive Solution with Search, Worst case happens when the tree is skew |
2 | O(n) | O(n) | Hashmap to optimize search process |