#二叉树
kitalekita
如果你觉得自己很菜,请你努力,因为你不努力更菜
展开
-
HDU 3791 二叉搜索树(模拟BST)
题目链接 Problem Description 判断两序列是否为同一二叉搜索树序列 Input 开始一个数n,(1<=n<=20) 表示有n个需要判断,n= 0 的时候输入结束。 接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。 接下去的n行有n个序列,每个序列格式跟第一个序列一样,请判断这两个序列是否能组成同一颗二叉搜索树。 Output 如果序列相同则输出YES,否则输出NO Sample Input 2 567432 54原创 2020-09-06 20:21:20 · 175 阅读 · 0 评论 -
The order of a Tree(模拟BST的建树和访问)
题目链接 Problem Description As we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely: insert a key k to a empty tree, then the tree become a tree with only one node; insert a key k to a nonempty tree, if原创 2020-09-05 21:00:34 · 157 阅读 · 0 评论 -
HDU 1710 Binary Tree Traversals(二叉树的遍历)
题目链接 Problem Description A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtrees. There are three most important ways in which the vertices of a binary tree can原创 2020-09-04 20:08:28 · 272 阅读 · 0 评论