02 2020 档案
摘要: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 sub
阅读全文
摘要:更新:1115 [1115 Counting Nodes in a BST:LIU] build函数内,为root声明变量地址 ,不需要 ,这样是重新声明另一个变量。 C++ //插入节点 void insert(node &root,int d) { if(root==NULL) {//若某个节点
阅读全文
摘要: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. In
阅读全文
摘要:题目:https://pintia.cn/problem sets/994805342720868352/problems/994805424153280512 1053 Path of Equal Weight (30分) Given a non empty tree with root R ,
阅读全文
摘要:本地能运行,但PAT显示编译错误 缺少头文件 变量取名不要使用C++库函数同名等此类关键词,例如:给数组取名 。会判定缺少头文件。 输出格式有误
阅读全文
摘要:更新至1115 注意 谨记一句话“ 所有变量使用前都要初始化赋值。 ” 经常碰到因为没初始化导致运算结果出错的情况,在C++中局部变量使用前一定要手动初始化,全局变量会默认初始化,但记来记去容易搞混,全部初始化吧。 变量尽量全放在开头定义 有时变量放在开头定义和就近定义的答案不一样 写代码时,设置最
阅读全文
摘要:1048 Find Coins (25分) Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal s
阅读全文
摘要:1020 Tree Traversals (25分) Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequen
阅读全文
摘要:题目:https://pintia.cn/problem sets/994805342720868352/problems/994805374509498368 1092 To Buy or Not to Buy (20分) Eva would like to make a string of be
阅读全文
摘要:1034 Head of a Gang (30分) One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B
阅读全文
摘要:1030 Travel Plan (30分) A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are sup
阅读全文
摘要:1003 Emergency (25分):最短路径Dijkstra算法 As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several s
阅读全文