dynamic_formula_execution_api.py
Folders and files Name Name Last commit message
Last commit date
parent directory
View all files
Horizontal distance between two nodes in binary tree
This is program to find horizontal distance between first and last node at same level in binary tree.
It must calculate the nodes which are not present.
The solution has two variants,
Solution 1 need to be passed root node of the tree. It will tell distance between all the nodes at same level
Solution 2 need to be passed two nodes along with root node of the tree. It return the distance between specified nodes
Python 3.6+ is supported
binary_tree.py has binary tree blueprint
main.py is driver code for solutions.
run the main.py to get the output
Solution 2 can be tested with any two nodes in same level (check last line)
Code is optimized for python 3.6+ only
Code is cross platform (Windows/UNIX)
No need to create env. no third party dependencies used
You can’t perform that action at this time.