摘要:
O(n)时间,O(1)空间对二叉树进行前序、中序、后序遍历。详细讲解看参考。public class Solution { public static void morrisPreorder(TreeNode root) { TreeNode cur = root; ... 阅读全文
摘要:
297. Serialize and Deserialize Binary Tree 思路:preorder遍历 便于deserialize。时空O(N)。 public class Codec { // Encodes a tree to a single string. public Strin 阅读全文