
数据结构-二叉树
文章平均质量分 83
JeraKrs
本人目前就职于百度商业研发部,有需要内推的朋友简历可发我邮箱 jerakrs@qq.com
展开
-
uva 11234 Expressions(后缀变层次)
ExpressionsArithmetic expressions are usually written with the operators in between the two operands (which is called infix notation). For example, (x+y)*(z-w) is an arithmetic expression in inf原创 2013-07-18 15:13:07 · 1240 阅读 · 0 评论 -
uva 548 tree(中序后序还原树)
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 o原创 2013-07-16 12:52:03 · 2261 阅读 · 0 评论 -
hdu 3791 二叉搜索树(二叉树)
题目链接:hdu 3791 二叉搜索树题目大意:中文题,略。解题思路:先建树,然后比较各个对应位置上的值是否相同。#include #include struct Node{ int val; Node* left; Node* right; Node(){ val = 0; left =原创 2014-03-17 19:01:25 · 1044 阅读 · 0 评论 -
poj 1785 Binary Search Heap Construction(笛卡尔树)
题目连接:poj 1785 Binary Search Heap Construction题目大意:给出一些节点,每个节点包括label 和 priority, 需要将这些节点排成一颗笛卡尔树(按照label为一颗二叉搜索树,按照priority为一个堆,数值大的一定在树的上层)。解题思路:一开始按照自己的想法,将节点按照priority的大小排序,从大到小,然后按照建二原创 2013-10-19 23:20:49 · 1689 阅读 · 0 评论 -
hdu 1671 Phone List(二叉树)
题目连接:hdu 1671 Phone List题目大意:给出n个电话号码,判断是否存在某个电话号码是另外一个电话号码的前缀。解题思路:建一个二叉树进行搜索时的优化。#include #include #define min(a,b) (a)<(b)?(a):(b)const int N = 50;int n, flag;struct node原创 2013-10-19 22:54:54 · 986 阅读 · 0 评论 -
uva 536 Tree Recovery (前序,中序变后序)
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原创 2013-08-08 00:20:25 · 1141 阅读 · 0 评论 -
uva 699 The Falling Leaves(建树)
The Falling Leaves Each year, fall in the North region is accompanied by the brilliant colors of the leaves on the trees, followed quickly by the falling leaves accumulating under the tr原创 2013-07-07 14:04:32 · 1136 阅读 · 0 评论 -
uva 712 S-Trees(利用二叉树的特点)
S-Trees A Strange Tree (S-tree) over the variable set is a binary tree representing a Boolean function. Each path of the S-tree begins at the root node and consists of n+1 nodes. Ea原创 2013-08-01 00:08:21 · 1699 阅读 · 0 评论 -
uva 839 Not so Mobile(抽象意义上的建树)
Not so Mobile Before being an ubiquous communications gadget, a mobile was just a structure made of strings and wires suspending colourfull things. This kind of mobile is usually found原创 2013-07-31 18:52:35 · 1484 阅读 · 0 评论 -
uva 297 Quadtrees
test#include#include#includeusing namespace std;#define N 10000int sum;char *move;void build(int n);int cut(char *t,int f) // 对 'p' 与 'f' 相遇时,'p'的后续子树进行删除{ for(int i=0;原创 2013-07-07 09:25:44 · 1563 阅读 · 0 评论 -
uva 112 Tree Summing(建树+遍历)
Tree Summing BackgroundLISP was one of the earliest high-level programming languages and, with FORTRAN, is one of the oldest languages currently being used. Lists, which are th原创 2013-07-31 13:41:04 · 2362 阅读 · 10 评论 -
hdu 5444 Elven Postman(二叉树)
题目链接:hdu 5444 Elven Postman其实就是一棵二叉搜索树,建完树遍历一下每个节点ans串就出来了。#include #include #include #include #include #include #include using namespace std;typedef long long ll;const int maxn原创 2015-09-13 21:56:47 · 898 阅读 · 0 评论