上一页 1 2 3 4 5 6 7 8 ··· 22 下一页
摘要: 大致题意就是给出一棵树的后序、中序遍历序列,然后建一棵树,,以蛇皮走位(奇层逆序,偶层顺序)输出其层序遍历序列。 1 #include<iostream> 2 #include<vector> 3 #include<queue> 4 #include<map> 5 using namespace s 阅读全文
posted @ 2020-03-18 19:09 tangq123 阅读(151) 评论(0) 推荐(0)
摘要: 题目大意:如果一个连通图的所有顶点的度都是偶数,那么它是Eulerian,如果除了两个顶点的度是奇数其它的是偶数,那么它是semi-Eulerian,否则它是Non-Eulerian。 题目翻译: 如果图G中的一个路径包括每个边恰好一次,则该路径称为欧拉路径。 如果一个回路是欧拉路径,则称为欧拉回路 阅读全文
posted @ 2020-03-18 17:56 tangq123 阅读(635) 评论(0) 推荐(0)
摘要: 英文版题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805350316752896 中文版题目:https://pintia.cn/problem-sets/994805260223102976/problems/9 阅读全文
posted @ 2020-03-18 16:56 tangq123 阅读(147) 评论(0) 推荐(0)
摘要: 英文版题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805350803292160 中文版题目:https://pintia.cn/problem-sets/994805260223102976/problems/9 阅读全文
posted @ 2020-03-18 16:46 tangq123 阅读(156) 评论(0) 推荐(0)
摘要: 题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805347523346432 本文完全参考刘婼的思路和代码!!! 参考地址:https://www.liuchuo.net/archives/3850 我刚开始想的是用 阅读全文
posted @ 2020-03-18 12:27 tangq123 阅读(239) 评论(0) 推荐(0)
摘要: 题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805347921805312 那天模拟考试做这道题时,直接把我心态搞崩了。如今再做这道题,感触颇深啊~ 借助中序遍历,除了根结点和叶子结点,遍历到其它结点时,在遍历 阅读全文
posted @ 2020-03-17 14:56 tangq123 阅读(266) 评论(0) 推荐(0)
摘要: 方法一:暴力求解,超时凉凉~~ 1 #include<iostream> 2 #include<unordered_map> 3 #include<vector> 4 #include<algorithm> 5 using namespace std; 6 7 bool cmp(const pair 阅读全文
posted @ 2020-03-17 14:20 tangq123 阅读(267) 评论(11) 推荐(0)
摘要: 大致题意就是给出包含N个元素的序列,判断其是否是N皇后的解。 已知每个坐标(x,f(x))的横坐标x不同,只需比较 1,列坐标是否相同f(x)(f(x1) - f(x2) == 0)。 2,两个坐标是否在同一对角线上(x1-x2 == |f(x1)-f(x2)|)。 满足1或2都不是解。 1 #in 阅读全文
posted @ 2020-03-17 10:17 tangq123 阅读(201) 评论(0) 推荐(0)
摘要: 题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805346063728640 红黑树满足二叉查找树的性质,左小于根,根小于右。 红黑树的特性:(1)每个节点或者是黑色,或者是红色。(2)根节点是黑色。(3)每个叶子节 阅读全文
posted @ 2020-03-16 22:23 tangq123 阅读(913) 评论(0) 推荐(0)
摘要: 题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805346428633088 方法一: 邻接表存储图,邻接矩阵标记边是否被访问,凉凉~~ 1 #include<iostream> 2 #include<vector> 阅读全文
posted @ 2020-03-16 16:51 tangq123 阅读(209) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 22 下一页