数据结构&&树
二叉树、线段树,字典树等
love亦菲
业精于勤,荒于嬉;行成于思,毁于随。
展开
-
hdu 1394 Minimum Inversion Number(树状数组逆序数)
Minimum Inversion Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 21391 Accepted Submission(s): 12815 Problem Description The原创 2017-08-31 10:14:59 · 272 阅读 · 0 评论 -
hdu 1556 Color the ball(区间更新,查询点)
Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 23156 Accepted Submission(s): 11242 Problem Description N个气球排成一排,从左到右依次编号为1,2,3....原创 2017-08-18 20:56:13 · 249 阅读 · 0 评论 -
hdu acm 1166 敌兵布阵
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 67316 Accepted Submission(s): 28313 Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子原创 2016-03-14 17:57:13 · 448 阅读 · 0 评论 -
hdu 5536 Chip Factory(01字典树带删除操作)
Time Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 3234 Accepted Submission(s): 1397 Problem Description John is a manager of a CPU c原创 2017-08-17 09:47:48 · 342 阅读 · 0 评论 -
csu-1216: 异或最大值
1216: 异或最大值 Time Limit: 2 Sec Memory Limit: 128 Mb Submitted: 836 Solved: 300 Description 给定一些数,求这些数中两个数的异或值最大的那个值 Input 多组数据。第一行为数字个数n,1 Output 任意两数最原创 2017-08-15 16:27:35 · 401 阅读 · 0 评论 -
hihocoder #1014 : Trie树
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。 这一天,他们遇到了一本词典,于是小Hi就向小Ho提出了那个经典的问题:“小Ho,你能不能对于每一个我给出的字符串,都在这个词典里面找到以这个字符串开头的所有单词呢?”原创 2017-08-15 09:58:26 · 202 阅读 · 0 评论 -
pat 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 differ by at most one; if at any time they differ by more than one, rebalancing is原创 2016-08-21 21:23:14 · 426 阅读 · 0 评论 -
pat1135 Is It A Red-Black Tree (30)(红黑树)
There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties: (1) Every node is either red or black. (2) The root is black. (3) Every原创 2017-09-26 17:59:18 · 1192 阅读 · 0 评论 -
ccf 201503-4 网络延时(求树的直径)
问题描述 给定一个公司的网络,由n台交换机和m台终端电脑组成,交换机与交换机、交换机与电脑之间使用网络连接。交换机按层级设置,编号为1的交换机为根交换机,层级为1。其他的交换机都连接到一台比自己上一层的交换机上,其层级为对应交换机的层级加1。所有的终端电脑都直接连接到交换机上。 当信息在电脑、交换机之间传递时,每一步只能通过自己传递到自己所连接的另一台电脑或交换机。请问,电脑与电脑之间原创 2016-08-05 13:26:30 · 613 阅读 · 0 评论 -
pat 1106. Lowest Price in Supply Chain (25)
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Starting from one root supplier, everyone on th原创 2016-07-23 22:03:56 · 583 阅读 · 0 评论 -
pat 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 subtree of a node contains only nodes with keys less than the node's key. The right原创 2016-07-22 10:16:03 · 417 阅读 · 0 评论 -
pat 1115 Counting Nodes in a BST (30)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than or equal to the node's key.原创 2016-07-22 09:18:55 · 1116 阅读 · 0 评论 -
pat 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 subtree of a node contains only nodes with keys less than the node's key.The right subt原创 2016-07-21 10:47:57 · 684 阅读 · 0 评论 -
pat 1110. Complete Binary Tree (25)
Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification: Each input file contains one test case. For each case, the first line gives a positive integer N (<=20) w原创 2016-07-20 18:01:48 · 667 阅读 · 0 评论 -
pat 1102. Invert a Binary Tree (25)
The following is from Max Howell @twitter: Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck off. Now it's your turn to p原创 2016-07-20 11:31:10 · 379 阅读 · 0 评论 -
pat 1004 Counting Leaves (30)
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file contains one test case. Each case starts with a line原创 2016-07-19 16:17:26 · 610 阅读 · 0 评论 -
pat 1043. Is It a Binary Search Tree (25)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than the node's key. The right原创 2016-07-19 13:44:57 · 338 阅读 · 0 评论 -
pat 1020. Tree Traversals (25)
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor原创 2016-07-19 10:26:07 · 400 阅读 · 0 评论 -
二叉树的遍历 非递归操作
#include #include #include #include #include #include using namespace std; typedef struct BiTNode{ char data; BiTNode *lchild, *rchild; }BiTNode,*BiTree; BiTree T; void CreateBiTree(BiTree &T)原创 2015-11-13 21:38:09 · 390 阅读 · 0 评论