我想使用 Python 将二叉树转换为数组,但我不知道如何为树节点提供索引?
我已经使用公式 left_son=(2*p)+1; 和 right_son=(2*p)+2; 在java中但我被困在python中。是否有任何函数可以为 python 中的树节点提供索引?
binary-tree python-3.x
binary-tree ×1
python-3.x ×1