08 2019 档案

[PAT]1067 Sort with Swap(0, i) (25 分)(运行超时解决办法)
摘要:一、题意 Given any permutation of the numbers {0, 1, 2,..., N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operatio 阅读全文

posted @ 2019-08-31 21:07 刘好念 阅读(7) 评论(0) 推荐(0) 编辑

[PAT]1126 Eulerian Path (25 分)(样例3答案错误原因)
摘要:一、题意 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 w 阅读全文

posted @ 2019-08-31 11:29 刘好念 阅读(9) 评论(0) 推荐(0) 编辑

[PAT]1101 Quick Sort (25 分)(样例2段错误原因)
摘要:一、题意 There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Th 阅读全文

posted @ 2019-08-30 18:58 刘好念 阅读(5) 评论(0) 推荐(0) 编辑

[leetcode]Leetcode中sort排序遇到的一些问题
摘要:转载自:https://www.cnblogs.com/flightless/p/10745318.html class Solution { public: static bool cmp(int a, int b){ return a>b; } int main(vector<int>& vec 阅读全文

posted @ 2019-08-27 08:47 刘好念 阅读(1) 评论(0) 推荐(0) 编辑

[LeetCode]1171. Remove Zero Sum Consecutive Nodes from Linked List
摘要:一、题意 Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences. After doing 阅读全文

posted @ 2019-08-26 21:45 刘好念 阅读(5) 评论(0) 推荐(0) 编辑

[PAT]1119 Pre- and Post-order Traversals (30 分)(样例1未过,运行时错误原因)
摘要:一、题目 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 an 阅读全文

posted @ 2019-08-15 10:54 刘好念 阅读(2) 评论(0) 推荐(0) 编辑

[PAT]1099 Build A Binary Search Tree (30 分)(只得22分的原因)
摘要:一、题目: 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 阅读全文

posted @ 2019-08-14 20:33 刘好念 阅读(1) 评论(0) 推荐(0) 编辑

判断一个数是不是质数(素数),3种方式介绍
摘要:本文参考博文判断一个数是不是质数(素数),3种方式介绍,原文章解释的已经很详细,本问增加部分博主自己的理解。 一、概念介绍 质数:质数是指在大于1的自然数中,除了1和它本身以外不再有其他因数的自然数。特别的0,1不是质数。 二、方法介绍 1.最直接的方法 bool isPrime(int n){ i 阅读全文

posted @ 2019-08-14 16:51 刘好念 阅读(1574) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

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