二叉树
admin__
这个作者很懒,什么都没留下…
展开
-
二叉搜索树
题目: 判断两序列是否为同一二叉搜索树序列 Input 开始一个数n,(1<=n<=20) 表示有n个需要判断,n= 0 的时候输入结束。 接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。 接下去的n行有n个序列,每个序列格式跟第一个序列一样,请判断这两个序列是否能组成同一颗二叉搜索树。 Output 如果...原创 2018-08-26 20:02:59 · 156 阅读 · 0 评论 -
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 fat trees. Quad- and octal-trees are fundament...原创 2018-08-26 20:34:36 · 167 阅读 · 0 评论 -
The order of a Tree
题目: As we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely: 1. insert a key k to a empty tree, then the tree become a tree with only one no...原创 2018-08-26 20:42:59 · 308 阅读 · 0 评论 -
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 tree to any leaf. The value of a path is the ...原创 2018-08-26 21:00:04 · 165 阅读 · 0 评论 -
The Falling Leaves
题目: 题目连接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=640 题意: 给一个先序二叉树,其中左子结点在父节点左一个单位,右节点在父节点右一个单位; 让从左到右输出每个水平位置的权值和; 思路: 定...原创 2018-08-26 21:15:02 · 252 阅读 · 0 评论 -
Tree Recovery
题目: Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes. This is an example of one of her c...原创 2018-08-19 21:20:19 · 119 阅读 · 0 评论 -
二叉树模板
最近学习的,关于二叉树的建立,前中后序遍历,和求二叉树高等。 #include<stdio.h> #include<stdlib.h> typedef struct node { int date; struct node* left; struct node* right; } Node; typedef struct { Node...原创 2018-08-25 10:31:41 · 120 阅读 · 0 评论 -
S-Trees
题目: 题目连接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=653 题意: 给出满二叉树叶结点的所有值,输入0代表向左走输入1代表向右走,输出最后到达的叶子的值。 思路: 根据满二叉树的性质,向左走编号*2,向...原创 2018-08-25 11:24:54 · 170 阅读 · 0 评论 -
Not so Mobile
题目连接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=780 题意: 给你一个杠杆两端的物体的质量和力臂,如果质量为零,则下面是一个杠杆,判断是否所有杠杆平衡。 思路: 递归输入,判断左右是否平衡; ...原创 2018-08-25 11:46:44 · 150 阅读 · 0 评论