随笔分类 -  二叉树相关

摘要:1086 Tree Traversals Again (25分) An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that wh 阅读全文
posted @ 2020-06-19 21:39 Cruel_King 阅读(304) 评论(0) 推荐(0) 编辑
摘要:1099 Build A Binary Search Tree (30分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left 阅读全文
posted @ 2020-06-11 22:50 Cruel_King 阅读(217) 评论(0) 推荐(0) 编辑
摘要:1064 Complete Binary Search Tree (30分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left 阅读全文
posted @ 2020-06-06 23:41 Cruel_King 阅读(280) 评论(0) 推荐(0) 编辑
摘要:1066 Root of AVL Tree (25分) An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node diff 阅读全文
posted @ 2020-06-05 21:49 Cruel_King 阅读(199) 评论(1) 推荐(0) 编辑
摘要:1020 Tree Traversals (25分) Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequen 阅读全文
posted @ 2020-03-23 22:20 Cruel_King 阅读(434) 评论(0) 推荐(0) 编辑
摘要:2018-11-23-02:27:37 原题链接 题目描述: 题目一目了然。 本题思路: 本题很容易能想到是构建表达式树然后按照层序逆序输出即可。 AC代码: 1 #include <cstdio> 2 #include <cstring> 3 #include <stack> 4 #include 阅读全文
posted @ 2018-11-23 02:11 Cruel_King 阅读(338) 评论(0) 推荐(0) 编辑
摘要:2018-11-20-18:25:23 一:二叉树 1.二叉树的性质 ①:在二叉树的第i层上至多有pow(2,i-1)个结点(i>=1)。 ②:深度为k的二叉树至多有pow(2,k)-1个结点(k>=1)。 ③:对任何一颗二叉树T,如果其终端结点的个数为n0,度为2的结点数为n2,则n0==n2+1 阅读全文
posted @ 2018-11-20 00:22 Cruel_King 阅读(1806) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示