more trees....🥺 🥺 🥺
Tips to myself:
- I did more leetcode problem with trees. I was not careful about binary trees vs BST.
- There are two general ways to traverse a tree, its DFS and BFS. BFS is also level order search. This is usually done with queues and stacks. Adding each of the popped left and right nodes to the q or stack. BFS usually pertains to more recursive searching, I believe BFS is related to in-order, pre-order, and post-order traversals. This is not level searched but kind of branched searched.
- If you are planning to attack a problem, using a recursive approach. Remember that a method could be inside a method in python and every recursive approach usually requires a helper. If the recursive approach becomes to hard to code, you DID IT WRONG!
No comments:
Post a Comment