随笔分类 -  pat

problems from pat
摘要: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 阅读全文
posted @ 2018-08-27 00:24 赖兴宇 阅读(355) 评论(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 ino 阅读全文
posted @ 2018-08-26 23:01 赖兴宇 阅读(241) 评论(0) 推荐(0)
摘要:The following is from Max Howell @twitter: Now it's your turn to prove that YOU CAN invert a binary tree! Input Specification: Each input file contain 阅读全文
posted @ 2018-08-26 22:24 赖兴宇 阅读(519) 评论(0) 推荐(0)
摘要:结构体自定义运算符 STL的使用 一. 二叉树相关: 前序, 中序, 后序, 层序遍历结果,分别用pre, in, post ,level表示的数组来记录 001.1020 Tree Traversals (25) https://www.cnblogs.com/mr-stn/p/9214298.h 阅读全文
posted @ 2018-08-26 18:41 赖兴宇 阅读(353) 评论(0) 推荐(0)
摘要:The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of the integers from 1 to N. F 阅读全文
posted @ 2018-07-24 22:37 赖兴宇 阅读(147) 评论(0) 推荐(0)
摘要:A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years 阅读全文
posted @ 2018-07-24 16:30 赖兴宇 阅读(157) 评论(0) 推荐(0)
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. At each iteration, ins 阅读全文
posted @ 2018-07-14 00:03 赖兴宇 阅读(140) 评论(0) 推荐(0)
摘要:This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed grap 阅读全文
posted @ 2018-07-12 21:46 赖兴宇 阅读(189) 评论(0) 推荐(0)
摘要:In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the 阅读全文
posted @ 2018-07-12 21:45 赖兴宇 阅读(339) 评论(0) 推荐(0)
摘要:In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which 阅读全文
posted @ 2018-06-28 20:27 赖兴宇 阅读(1158) 评论(0) 推荐(0)
摘要:Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is t 阅读全文
posted @ 2018-06-28 19:46 赖兴宇 阅读(280) 评论(0) 推荐(0)
摘要:A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as po 阅读全文
posted @ 2018-06-28 17:57 赖兴宇 阅读(199) 评论(0) 推荐(0)
摘要:It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that c 阅读全文
posted @ 2018-06-28 15:24 赖兴宇 阅读(144) 评论(0) 推荐(0)
摘要:As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some ro 阅读全文
posted @ 2018-06-28 10:56 赖兴宇 阅读(309) 评论(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 social n 阅读全文
posted @ 2018-06-28 01:34 赖兴宇 阅读(131) 评论(0) 推荐(0)
摘要: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, we say that A and B is re 阅读全文
posted @ 2018-06-28 00:54 赖兴宇 阅读(135) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-06-27 13:00 赖兴宇 阅读(166) 评论(0) 推荐(0)
摘要:On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear rep 阅读全文
posted @ 2018-06-27 11:12 赖兴宇 阅读(271) 评论(0) 推荐(1)
摘要:继续加油 2018/6/27 阅读全文
posted @ 2018-06-27 10:25 赖兴宇 阅读(270) 评论(0) 推荐(0)
摘要:1110 Complete Binary Tree (25)(25 分) Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification: Each input file cont 阅读全文
posted @ 2018-06-27 10:24 赖兴宇 阅读(212) 评论(0) 推荐(0)