随笔分类 -  PTA甲级

摘要:题目: 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 阅读全文
posted @ 2023-05-24 10:24 Yohoc 阅读(45) 评论(0) 推荐(0) 编辑
摘要:题目: Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and 阅读全文
posted @ 2023-05-23 13:51 Yohoc 阅读(19) 评论(0) 推荐(0) 编辑
摘要:题目: 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 no 阅读全文
posted @ 2023-05-23 09:46 Yohoc 阅读(12) 评论(0) 推荐(0) 编辑
摘要:题目: 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 no 阅读全文
posted @ 2023-05-22 11:19 Yohoc 阅读(33) 评论(0) 推荐(0) 编辑
摘要:题目: 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 no 阅读全文
posted @ 2023-05-22 09:43 Yohoc 阅读(11) 评论(0) 推荐(0) 编辑
摘要:1. 以引用或指针形式传入: cpp void foo(std::vector<int> &vec); // 以引用形式传入 void bar(std::vector<int> *ptr); // 以指针形式传入 这种方式不会复制vec,函数内操作的是vec本身。可以改变vec。例如: cpp st 阅读全文
posted @ 2023-05-21 10:36 Yohoc 阅读(850) 评论(0) 推荐(0) 编辑
摘要:题目: Given a non-empty tree with root R, and with weight Wi​assigned to each tree node Ti​. The weight of a path from R to L is defined to be the sum o 阅读全文
posted @ 2023-05-21 10:35 Yohoc 阅读(28) 评论(0) 推荐(0) 编辑
摘要:题目: 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 阅读全文
posted @ 2023-05-20 11:46 Yohoc 阅读(12) 评论(0) 推荐(0) 编辑
摘要:题目: An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with 阅读全文
posted @ 2023-05-20 11:01 Yohoc 阅读(10) 评论(0) 推荐(0) 编辑
摘要:题目: A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to fi 阅读全文
posted @ 2023-05-20 09:34 Yohoc 阅读(11) 评论(0) 推荐(0) 编辑
摘要:二维都变长的二维容器数组 1、在C++中,可以这样初始化一个二维vector数组并指定大小: cpp vector<vector<int>> vec(3, vector<int>(4)); 这个代码会创建一个3行4列的二维vector数组,每个元素初始化为0:vec = [0 0 0 0][0 0 阅读全文
posted @ 2023-05-18 14:08 Yohoc 阅读(7951) 评论(1) 推荐(0) 编辑
摘要:题目: Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed t 阅读全文
posted @ 2023-05-16 09:48 Yohoc 阅读(15) 评论(0) 推荐(0) 编辑
摘要:One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions 阅读全文
posted @ 2023-05-15 22:22 Yohoc 阅读(15) 评论(0) 推荐(0) 编辑
摘要:题目: The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a progr 阅读全文
posted @ 2023-05-14 13:52 Yohoc 阅读(12) 评论(0) 推荐(0) 编辑
摘要:题目: Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a soci 阅读全文
posted @ 2023-05-14 10:51 Yohoc 阅读(13) 评论(0) 推荐(0) 编辑
摘要:With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing ba 阅读全文
posted @ 2023-05-12 17:56 Yohoc 阅读(13) 评论(0) 推荐(0) 编辑
摘要:Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, 阅读全文
posted @ 2023-02-28 09:20 Yohoc 阅读(40) 评论(0) 推荐(0) 编辑
摘要:Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given 阅读全文
posted @ 2023-02-27 09:58 Yohoc 阅读(16) 评论(0) 推荐(0) 编辑
摘要:Given a stack which can keep M numbers at most. Push Nnumbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given se 阅读全文
posted @ 2023-02-27 09:12 Yohoc 阅读(29) 评论(0) 推荐(0) 编辑
摘要:A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, namely, T for the top level, A for advance and B for 阅读全文
posted @ 2023-02-24 20:34 Yohoc 阅读(21) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示