Thursday, September 13, 2018

[LeetCode]Serialize and Deserialize N-ary Tree

这道题我们套用我们Serialize and Deserialize Binary Tree的第一种序列化的方法,用(rootVal(subtree1)(subtree2)...(subtreeN))来表示即可。时间复杂度O(N),N为输入Tree的节点数。代码如下:


No comments:

Post a Comment