上一页 1 2 3 4 5 6 7 ··· 22 下一页
摘要: 题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805359372255232 算法思想:采用层次遍历,将所有结点(包括空结点)入队。当遇到空结点时,查看其后是否有非空结点。若有,则二叉树不是完全二叉树。 1 #inc 阅读全文
posted @ 2020-03-21 15:28 tangq123 阅读(145) 评论(0) 推荐(0)
摘要: 题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805355987451904 大致题意就是给出一个序列,构造一棵二叉查找树,输出最大深度和次最大深度的结点个数之和。 方法一,BFS 1 #include<iostre 阅读全文
posted @ 2020-03-21 12:57 tangq123 阅读(170) 评论(0) 推荐(0)
摘要: 题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805357258326016 大致题意:给出一个包含n个正整数的集合,把集合分成s1,s2,n1,n2分别是s1,s2的元素个数。要求输出 最小|n1-n2|,最大|s 阅读全文
posted @ 2020-03-21 11:37 tangq123 阅读(154) 评论(0) 推荐(0)
摘要: 题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805357933608960 分析: 首先,遍历字符串str,筛选出所有好键,判断好键方法:如果当前字符连续出现的次数不是 k的整数倍,那么标记该字符为好键。 然后,定 阅读全文
posted @ 2020-03-21 11:03 tangq123 阅读(166) 评论(0) 推荐(0)
摘要: 英文题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805354762715136 中文题目:https://pintia.cn/problem-sets/994805260223102976/problems/994 阅读全文
posted @ 2020-03-19 18:41 tangq123 阅读(197) 评论(0) 推荐(0)
摘要: 英文题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805355358306304 中文题目:https://pintia.cn/problem-sets/994805260223102976/problems/994 阅读全文
posted @ 2020-03-19 17:04 tangq123 阅读(163) 评论(0) 推荐(0)
摘要: 这是一道模板题,要先记住大体流程,然后反复练习。 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int father[10010]; 6 7 void init() { 8 for(int i = 1; i 阅读全文
posted @ 2020-03-19 15:42 tangq123 阅读(185) 评论(0) 推荐(0)
摘要: 英文题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805352359378944 中文题目:https://pintia.cn/problem-sets/994805260223102976/problems/994 阅读全文
posted @ 2020-03-19 11:05 tangq123 阅读(146) 评论(0) 推荐(0)
摘要: 题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805351814119424 大致题意就是给出一个图,K个不同的路径,判断是否是哈密尔顿路径,即包括图中所有顶点的环。 分析: 1,判断路径能否走通,能则输出NO,否则 阅读全文
posted @ 2020-03-19 10:26 tangq123 阅读(580) 评论(0) 推荐(0)
摘要: 英文版题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805352925609984 中文版题目:https://pintia.cn/problem-sets/994805260223102976/problems/9 阅读全文
posted @ 2020-03-18 20:23 tangq123 阅读(166) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 22 下一页