上一页 1 2 3 4 5 6 ··· 13 下一页
摘要: The “travelling salesman problem” asks the following question: “Given a list of cities and the distances between each pair of cities, what is the shor 阅读全文
posted @ 2022-02-27 16:47 勇往直前的力量 阅读(23) 评论(0) 推荐(0) 编辑
摘要: A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique 阅读全文
posted @ 2022-02-27 15:42 勇往直前的力量 阅读(75) 评论(0) 推荐(0) 编辑
摘要: The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle". In this pr 阅读全文
posted @ 2022-02-27 10:47 勇往直前的力量 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 1013 1013 点击查看代码 #include <bits/stdc++.h> using namespace std; vector<int> G[10010]; bool vis[10010]; int curpoint; void dfs(int index) { if(index==cu 阅读全文
posted @ 2022-02-26 22:51 勇往直前的力量 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 1086 1086 发现一个问题,如果vector事先resize了的话,再用push_back()添加元素就会失败,这种情况应该像数组那样处理。All in all,要么不resize然后push_back();要么resize用下标添加。 点击查看代码 #include <bits/stdc++ 阅读全文
posted @ 2022-02-26 11:45 勇往直前的力量 阅读(281) 评论(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 @ 2022-02-26 11:37 勇往直前的力量 阅读(23) 评论(0) 推荐(0) 编辑
摘要: The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. Given any two nodes in a bin 阅读全文
posted @ 2022-02-26 10:27 勇往直前的力量 阅读(29) 评论(0) 推荐(0) 编辑
摘要: Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to out 阅读全文
posted @ 2022-02-25 19:58 勇往直前的力量 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 1004 1004 #include <bits/stdc++.h> using namespace std; vector<int> G[101]; int leaf[101]; int maxh; void DFS(int root,int h) { maxh=max(maxh,h); if(G 阅读全文
posted @ 2022-02-24 22:00 勇往直前的力量 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 1124 Raffle for Weibo Followers (20 分)(map) John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Wei 阅读全文
posted @ 2022-02-24 19:59 勇往直前的力量 阅读(25) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 13 下一页