b*g
2 楼
那位老大给提供的电话b吧,thanks
g*x
3 楼
如果是binary的话inorder+preorder或inorder+postorder
n-nary存(node, parent) pair貌似可以,不知道有什么更好的方法
n-nary存(node, parent) pair貌似可以,不知道有什么更好的方法
g*x
8 楼
LZ问的是N叉树,不一定能用中序遍历
j*x
10 楼
Do a pre-order traversal, after the traversing of a subtree, record the size
of the subtree with that node. Got some thing like this:
serialized_node,size_of_the_sub_tree_rooted_at_this_node,node,size
A recursive deserialization process is easy to get.
As for two traversal, I dont get it. Meaning to store two arrays of node
keys? But a serious problem is that we need to traverse twice of the tree.
Not good.
of the subtree with that node. Got some thing like this:
serialized_node,size_of_the_sub_tree_rooted_at_this_node,node,size
A recursive deserialization process is easy to get.
As for two traversal, I dont get it. Meaning to store two arrays of node
keys? But a serious problem is that we need to traverse twice of the tree.
Not good.
P*l
11 楼
size
More explanation on the "serialized_node"? Seems you saved redundant info.
No. Only one traversal can obtain both arrays.
The problem of the method is in deserialization. One traversal needs to look
up ids in another one to recover the tree.
I don't think the two traversal method is practical for serialization.
【在 j********x 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: Do a pre-order traversal, after the traversing of a subtree, record the size
: of the subtree with that node. Got some thing like this:
: serialized_node,size_of_the_sub_tree_rooted_at_this_node,node,size
: A recursive deserialization process is easy to get.
: As for two traversal, I dont get it. Meaning to store two arrays of node
: keys? But a serious problem is that we need to traverse twice of the tree.
: Not good.
相关阅读
BB&T的 $100 bonus谁拿到了吗?大错!!Chase $125需要多少initial deposit?请问现在从国内汇钱到美国最方便的是哪种方式?fidelity的mileage+$100的deal只来过一次吗?ing 上不去了?discover more卡钱半年都不用还款?现在的CSR真有耐心阿谁在中国打过collect电话? (转载)Fidelity Amex bonus有没有1099 表?Schwab的Brokerage Account只能邮寄申请啊?请问关于储蓄账户的maintenance费用British airway mileage买AA的美国国内航班,一个空位也查不出来?为啥我的chase 125的bonus 被扣了35的联邦税啊question about new card请问: 通过experian查不到我的ssn,这是什么情况往国内汇钱,收款人的拼音应该怎么写有人收到suntrust的第一个50了吗问个弱弱的问题,果园卡用了virtual还有cb么?Chase BA Visa 5K bonus for adding authorized user