- 博客(23)
- 收藏
- 关注
原创 红黑树总结
红黑树:30张图带你彻底理解红黑树 - 简书 (jianshu.com)性质1:每个节点要么是黑色,要么是红色。 性质2:根节点是黑色。 性质3:每个叶子节点(NIL)是黑色。NIL为空的叶子节点 性质4:每个红色结点的两个子结点一定都是黑色。 性质5:任意一结点到每个叶子结点的路径都包含数量相同的黑结点。 左旋:以某个结点作为支点(旋转结点),其右子结点变为旋转结点的父结点,右子结点的左子结点变为旋转结点的右子结点,左子结点保持不变。 右旋:以某个结点作为支点(旋转结点),其左子结点变为旋转
2021-06-07 23:20:24
173
3
原创 算法-全排列
全排列从n个不同元素中任取m(m≤n)个元素,按照一定的顺序排列起来,叫做从n个不同元素中取出m个元素的一个排列。当m=n时所有的排列情况叫全排列#include <iostream>using namespace std;int a[3] = {1, 2, 3};int visit[3] = {0};int path[3] = {0};int count = 0;void dfs(int index) { if (count >= 3) {
2021-05-22 23:07:48
131
原创 SpringAOP的cglib,dynamic总结
cglibdynamic怎么用?代理对象实现了接口,默认dynamic代理对象实现了接口,可强制cglib代理对象是单纯类没实现接口,只能用cglib原因:dynamicProxy的生产代理增强类的**Proxy.newProxyInstance.(ClassLoaderloader, Class<?>[]interfaces, InvocationHandlerh)**代理对象需要是接口类型...
2021-03-04 23:15:18
167
1
原创 SpringBoot传文件的踩坑
错误:the request was rejected because no multipart boundary was found在request header 加上 Content-Type :multipart/form-data;boundary=1111 随机数字都可以
2020-09-17 21:28:11
304
原创 MYSQL的SQL优化,多表连接后有order by排序,出现Using temporary; Using filesort情况
使用EXPLIAN字段可以对sql语句进行分析,当extra有Using temporary; Using filesort等时表示需要进行优化,意思分别是用了临时表和一种sql的排序。eg1:select * from a inner join b where a.id=b.aid order by a.id;这种情况下:如果a的集合比b小,那么mysql就会以a为驱动表,这个时候如...
2019-07-10 22:48:11
7841
2
原创 springBoot传list类型的注意
list = JSON.stringify(list); // layer.msg(JSON.stringify(list)) layer.confirm('确认要删除吗?' , function(index) { //捉到所有被选中的,发异步进行删除 $.ajax({ ...
2019-04-13 19:46:09
5688
原创 OJ kruskal算法求最小生成树
总时间限制: 10000ms单个测试点时间限制: 1000ms内存限制: 65536kB描述要求对一个图使用kruskal算法求最小生成树,依次输出选出的边所关联的顶点序列,要求下标较小者在前,如图所示,其顶点序列为1 3 4 6 2 5 3 6 2 3输入若干行整数第一行为两个整数,分别为图的顶点数和边数第二行开始是该图的邻接矩阵,主对角线统一用0表示,无直接路径的两点用100来表示(保证各边权...
2018-04-13 17:30:50
1300
3
原创 OJ 赫夫曼编码
描述先从键盘输入若干电文所用符号及其出现的频率,然后构造赫夫曼树,从而输出赫夫曼编码。注意:为了保证得到唯一的赫夫曼树,这里规定在构造赫夫曼树时,左孩子结点权值不大于右孩子结点权值,如若有多种选择,则尽量先选序号偏小的结点。编码时,左分支取“0”,右分支取“1”输入3行第1行:符号个数n(2~20);第2行:符号,用空格分隔;第3行:各符号出现频率(用乘以100后的整数),用空格分隔;输出各符号对...
2018-04-13 12:59:35
1225
1
原创 PAT 甲级 1011. World Cup Betting (20)
#include <iostream>#include "cstring"#include <stdio.h>#include "iomanip"#include "vector"#include "cmath"#include "stack"#include "algorithm"#include <m
2018-03-20 17:15:31
140
原创 OJ 4127:迷宫问题 递归输出路径
描述定义一个二维数组: int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。输入一个5 × 5的二维数组,表示一个迷宫。数...
2018-03-18 18:13:14
602
原创 OJ 3752:走迷宫 bfs
总时间限制: 1000ms内存限制: 65536kB描述一个迷宫由R行C列格子组成,有的格子里有障碍物,不能走;有的格子是空地,可以走。给定一个迷宫,求从左上角走到右下角最少需要走多少步(数据保证一定能走到)。只能在水平方向或垂直方向走,不能斜着走。输入第一行是两个整数,R和C,代表迷宫的长和宽。( 1<= R,C <= 40)接下来是R行,每行C个字符,代表整个迷宫。空地格子用'.'...
2018-03-18 17:32:52
417
原创 六度空间 (bfs,广度优先)
7-9 六度空间(30 分)“六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图1所示。图1 六度空间示意图“六度空间”理论虽然得到广泛的认同,并且正在得到越来越多的应用。但是数十年来,试图验证这个理论始终是许多社会学家努力追...
2018-03-17 17:57:08
974
原创 openjudge 拦截导弹 (DP 动态规划)
样例输入8389 207 155 300 299 170 158 65样例输出6当整个数组位递增序列时候输出1,所以用来记录最大值maxx=1,不然会输出0,卡在这里好久,dp写的没错,但是ac不了,后来对比别人的代码,发现问题,还有一个注意点,a[i]>=a[j](i<j) ,因为是不递增序列,等于情况符合#include <iostream>#include "cs...
2018-03-15 17:24:22
332
原创 openjudge 最大子矩阵 (DP 动态规划)
#include <iostream>#include "cstring"#include <stdio.h>#include "iomanip"#include "vector"#include "cmath"#include "stack"#include "algorithm"#include <m
2018-03-15 16:02:21
257
原创 PAT 甲级 1009. Product of Polynomials (Map)
This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the information...
2018-03-12 16:41:42
185
原创 PAT 甲级 1007. Maximum Subsequence Sum (DP 动态规划)
部分正确#include <iostream>#include "cstring"#include <stdio.h>#include "iomanip"#include "vector"#include "cmath"#include "stack"#include "algorithm"#include &
2018-02-20 17:52:27
214
原创 PAT 甲级 1008. Elevator
#include <iostream>#include "cstring"#include <stdio.h>#include "iomanip"#include "vector"#include "cmath"#include "stack"#include "algorithm"#include <m
2018-02-20 17:49:43
127
原创 PAT 甲级 1006. Sign In and Sign Out
测试用例Sample Input:3CS301111 15:30:28 17:00:10SC3021234 08:00:00 11:25:25CS301133 21:45:00 21:58:40Sample Output:SC3021234 CS301133输出最早的人和最晚的人#include <iostream>#include "cstring"#include &l...
2018-02-13 18:55:52
241
原创 PAT 甲级 1005. Spell It Right (递归)
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Each ca...
2018-02-12 18:33:01
217
原创 PAT 甲级 1003. Emergency 使用 优先队列 dijkstra 算法
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the l...
2018-02-12 14:27:52
267
原创 PAT 甲级 1004. Counting Leaves 使用深度遍历(DFS)
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case starts with a line contai...
2018-02-12 14:05:40
219
原创 PAT 甲级 1002 A+B for Polynomials
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomia...
2018-02-11 19:01:33
146
原创 PAT 甲级 1001 A+B Format
开两个数组,一个存数字,一个存逗号,一开始用递归快点写了,发现逗号不好处理改用2个数组做了#include <iostream>#include "cstring"#include <stdio.h>#include "iomanip"#include "vector"#include "cmath"#include "stack"#inc
2018-02-11 18:37:09
159
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人