2018年2月23日

PAT L2-011 玩转二叉树(二叉树层序遍历)

摘要: 给定一棵二叉树的中序遍历和前序遍历,请你先将树做个镜面反转,再输出反转后的层序遍历的序列。所谓镜面反转,是指将所有非叶结点的左右孩子对换。这里假设键值都是互不相等的正整数。 输入格式: 输入第一行给出一个正整数N(<=30),是二叉树中结点的个数。第二行给出其中序遍历序列。第三行给出其前序遍历序列。 阅读全文

posted @ 2018-02-23 16:36 大桃桃 阅读(370) 评论(0) 推荐(0)

UVa 548 Tree(二叉树最短路径)

摘要: You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary 阅读全文

posted @ 2018-02-23 15:33 大桃桃 阅读(305) 评论(0) 推荐(0)

UVa 122 Trees on the level(二叉树层序遍历)

摘要: Trees are fundamental in many branches of computer science. Current state-of-the art parallel computers such as Thinking Machines’ CM-5 are based on f 阅读全文

posted @ 2018-02-23 14:13 大桃桃 阅读(282) 评论(0) 推荐(0)

导航