摘要: 首先解决依赖问题:打开pom.xml 2、打开File->setting 将里面的User setting file位置找到,放上settings.xml(注意要打开,将第一行位置改一下) 3、右键pom文件,把他作为maven项目,然后reimport 阅读全文
posted @ 2018-11-27 15:13 Sunshine&暖阳 阅读(785) 评论(0) 推荐(0) 编辑
摘要: 二叉树的前序、中序、后序遍历的定义: 前序遍历:对任一子树,先访问跟,然后遍历其左子树,最后遍历其右子树; 中序遍历:对任一子树,先遍历其左子树,然后访问根,最后遍历其右子树; 后序遍历:对任一子树,先遍历其左子树,然后遍历其右子树,最后访问根。 给定一棵二叉树的前序遍历和中序遍历,求其后序遍历(提 阅读全文
posted @ 2018-06-02 11:03 Sunshine&暖阳 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the 阅读全文
posted @ 2018-05-09 21:42 Sunshine&暖阳 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "ins 阅读全文
posted @ 2018-04-26 22:08 Sunshine&暖阳 阅读(99) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int nextVal[1000]; //next数组就是子串s[0...i]的 //... 阅读全文
posted @ 2018-04-22 11:31 Sunshine&暖阳 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 在0-1背包问题中,我们设 表示在考虑了前i个物品后,大小为V的背包的最大价值, 表示第i件物品的重量, 表示第i件物品的价值,其状态转移方程为 如果我们把 看做关于背包容积V的函数列,则很容易发现 只与 , , 相关,即 可以由 递推得来。 既然i-1以前的F都用不到,我们就可以使用滚动数组了,即 阅读全文
posted @ 2018-04-12 09:32 Sunshine&暖阳 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 普里姆求解: -克鲁斯卡尔: 阅读全文
posted @ 2018-04-11 10:52 Sunshine&暖阳 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 状态转移方程: dp[i]=max{A[i],dp[i-1]+A[i]} 阅读全文
posted @ 2018-04-10 10:28 Sunshine&暖阳 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 递推:自底向上,即从边界开始不断向上解决问题,直到解决了目标问题; 递归:自顶向下,即从目标问题开始,将他分解为子问题的组合,直到分解至边界为止 阅读全文
posted @ 2018-04-10 10:07 Sunshine&暖阳 阅读(1230) 评论(0) 推荐(0) 编辑
摘要: 步骤: 1.定义一个队列Q,并把所有入度为0的结点加入 2.取队首输出,然后删去所有从它出发的边,并令这些边到达顶点的入度-1,如果某个顶点的入度减为0则将其放入队列 3.重复2直到队列为空。如果队列未空时结点数目恰为N,说明拓扑排序成功 有向无环图 阅读全文
posted @ 2018-04-09 17:20 Sunshine&暖阳 阅读(182) 评论(0) 推荐(0) 编辑