数据结构
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 评论 -
The Suspects(并查集)
题目链接 Description Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others. In th原创 2020-09-03 20:43:35 · 121 阅读 · 0 评论 -
POJ-2236 Wireless Network(并查集)
Wireless Network Description An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the network were all broken. The原创 2020-09-02 21:31:20 · 97 阅读 · 0 评论 -
并查集简单题目其一
How Many Tables Problem Description Today is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, and all the friends d原创 2020-09-01 20:25:53 · 245 阅读 · 0 评论