All Questions
Tagged with binary-tree python
5 questions
2
votes
1
answer
132
views
Find ALL duplicate subtrees. using recursion
This is just a practice exercise, I'm trying to understand dynamic programming as deeply as I can. I solved this using recursion, though I am not sure if it will always work. If anyone could tell me a ...
2
votes
1
answer
203
views
Implementation of binary tree traversal
Based on what i understood of Binary Tree, queue and recursion I implemented this Breadth First Search algorithm as follows.
Do you have any suggestions to improve (in term of readability, good ...
2
votes
2
answers
221
views
Lowest Common Ancestor in Binary Tree (Iterative)
In the below code I've implemented a method to find the lowest common ancestor of a binary tree.
This is an iterative approach using this pseudocode.
Please suggest any improvements that can be made.
<...
1
vote
1
answer
220
views
Best way to store the sum of all node depths?
To sum up all the nodes' depths in any given binary tree, I've written the following recursive algorithm:
...
5
votes
1
answer
143
views
AVL Tree implementation Based on VisualGo
I have tried implementing an AVL Tree on my own, based on visualising it. But i'm unsure how many testcases it work with, and how efficient it is. Are there any ways to make it efficient, and compact?
...