自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(105)
  • 资源 (1)
  • 收藏
  • 关注

原创 大(长)浮点数加法

(C++代码)转载链接:https://blog.csdn.net/qq_36721800/article/details/104649796牛客链接:https://www.nowcoder.com/practice/ddec753f446e4ba4944e35378ba635c8?tpId=61&tqId=29551&tPage=3&ru=/kaoyan/retest/1002&qru=/ta/pku-kaoyan/question-rankingjava代码pub

2021-01-29 22:26:30 604 1

原创 线程池

线程池一、线程池1、JVM使用的是KLT的线程模型2、ULT:KLT = 1:13、线程池工作原理public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,

2021-01-28 19:47:21 165

原创 JVM学习笔记(快速版)

JVM1、常见面试问题## 1、谈谈堆JVM的理解## 2、java8中JVM的新内容## 3、什么是OOM、什么是StackOverFlowError?怎么分析## 4、JVM的调优常见参数## 5、内存快照如何抓取## 6、如何分析Dump文件2、JVM的位置3、JVM的体系结构[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-55yUPkq2-1611572145752)(C:\Users\29683\AppData\Roamin

2021-01-25 18:56:16 176

原创 Spring整合mybatis例子

1、固定模板spring-dao.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/..

2021-01-07 22:10:51 100

原创 Spring不同类型的注入方式,p-namespace,c-namespace

applicaContext.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/bean

2021-01-04 09:30:15 187 1

原创 堆的创建、排序C++

思路:大堆1、堆都是完全二叉树。2、将节点V和他的左右孩子比较(如果有的话),加入孩子中存在权值比V大的节点,就将其中最大的与V对换,交换完毕后继续让V与其孩子节点进行比较,直到几点V的孩子的权值都比V小或者V不存在孩子节点。3、完全二叉树的叶子节点个数为int(n/2),因此在数组下标[1,n/2]范围内的节点都是非叶子节点。于是从n/2号位开始倒着枚举节点。4、删除堆顶元素,只需要将最后一个元素覆盖对顶元素。5、插入节点,可以把想要插入的节点放在二叉树的最后,然后向上调整,把与调整节点与其父节

2020-06-27 22:45:47 114

原创 PAT甲级(1091)

题意理解(个人看法)1、每层MN个像素点共有L层,所以对一个MN*L的三维物体进行扫描,采用BFS进行搜索。2、X、Y、Z数组中的1和-1代表前后左右上下方向,1表示前进一格想正方向搜索,-1表示后退一格向后方搜索。3、先向X的正向搜索如果为1,cnt++,同时判断是否越界。...

2020-06-26 22:19:10 205

原创 PAT甲级(1074)

只做到了24分最后一个数据点没通过,但个人感觉比柳神的更容易理解。1、首先将原始链加入v;2、先算出分组g = n/k,对g个分组进行逆置加入ans,将剩下的n%k原顺序输出加入ans;#include <bits/stdc++.h>using namespace std;struct node{ int id,val,next;}a[100010];vector<node> v,ans;int main(){ int start,n,k;

2020-06-24 22:31:40 150

原创 C++指针创建完全二叉搜索树(CBT)

参考文章数组格式,指针形式可以随意指定遍历形式#include <bits/stdc++.h>using namespace std;int arr[1010]={0};struct node{ int val; struct node *lchild,*rchild;};int getLeftLength(int n){ int height = floor(log(n+1)/log(2)); int x = n+1-pow(2,heig

2020-06-23 15:51:01 156

原创 PAT甲级(1057):Stack

树状数组参考链接很详细:树状数组详解#include <iostream>#include <stack>#define lowbit(i) ((i) & (-i))const int maxn = 100010;using namespace std;int c[maxn];stack<int> s;void update(int x, int v) { for(int i = x; i < maxn; i += lowbit(i)

2020-06-19 22:47:12 104

原创 PAT甲级1135

红黑树的特点1、根节点是黑色。2、如果一个节点是红色那么他的两个子节点都是红色。3、任意从根节点到叶子结点的路径上,所有的路径经过的黑色节点数相同。4、红黑树是二叉搜索树。算法1、根节点是否为黑色。2、红色节点的两个子节点是不是都是黑色。3、所有路径经过的黑色节点数是不是相同的。#include <bits/stdc++.h>using namespace std;vector<int> arr;struct node{ int key;

2020-05-27 15:42:42 198 1

原创 PAT甲级1072

#include <iostream>#include <algorithm>#include <string>using namespace std;const int inf = 999999999;int n, m, k, ds, station;int e[1020][1020], dis[1020];bool visit[1020];int main() { fill(e[0], e[0] + 1020 * 1020, inf);

2020-05-26 16:00:10 128

原创 PAT甲级1013

假设将index点去掉之后,剩下的点构成两个连通分量,则只需要一条路就行,若剩下的点构成3个连通分量则只需要2个就行,依次类推,对每个城市进行遍历,需要的公路数量就是去掉这个城市的连通分量的个数cnt-1.#include <bits/stdc++.h>using namespace std;int e[1010][1010];bool visit[1010];int n,m,k;void dfs(int u){ visit[u] = true; for(in

2020-05-25 16:13:45 104

原创 PAT甲级1034

#include <bits/stdc++.h>using namespace std;map<string,int> stringToInt;map<int,string> intToString;map<string,int> ans;int idNumber=1,k;int G[2010][2010],weight[2010];bool visit[2010];int stoifunc(string s){ if(stri

2020-05-25 15:15:24 112

原创 PAT甲级1111

使用两次DIjikstra+dfs算法#include <bits/stdc++.h>using namespace std;const int inf=99999;int e[510][510],w[510][510],dis[510],weight[510],nodeNum[510];bool visit[510];int n,m,c1,c2;vector<int> pre[510],pre2[510],dispath,timepath;void dfsdis

2020-05-23 22:53:54 95

原创 PAT甲级1111

使用两次Dijikstra+dfs#include <bits/stdc++.h>using namespace std;const int inf=99999;int e[510][510],w[510][510],dis[510],weight[510],nodeNum[510];bool visit[510];int n,m,c1,c2;vector<int> pre[510],pre2[510],dispath,timepath;void dfsdispa

2020-05-23 22:52:48 76

原创 PAT甲级1087

#include <bits/stdc++.h>using namespace std;const int inf = 99999;int e[210][210],weight[210],dis[210],num[210],w[210];bool visit[210];int n ,m,c1,c2,sum=0;vector<int> pre[210],path;struct node{ int id; string name; int wei

2020-05-23 16:25:36 131

原创 PAT甲级1030

第一个自己完全做对的最短路径题。。。#include <bits/stdc++.h>using namespace std;const int inf=999999;int Cost[510][510],e[510][510],dis[510],cost[510];bool visit[510];int n,m,c1,c2;vector<int> pre[510],tmp;void dfs(int v){ tmp.push_back(v); fo

2020-05-23 15:14:49 150

原创 PAT甲级1018

1、先求出到各点的最短距离放在dis中,并用pre存储到v节点最短距离的上一个节点。2、再对从sp开始的pre[v]做dfs找出最小back和最小need;#include <bits/stdc++.h>using namespace std;const int inf = 99999999;int cmax, n, sp, m;int minNeed = inf, minBack = inf;int e[510][510], dis[510], weight[510];boo

2020-05-22 22:46:16 146

原创 PAT甲级1094

自己的代码23/25#include <bits/stdc++.h>using namespace std;struct node{ int id; vector<int> child;};vector<node> v;int cnt[20] = {0};void dfs(int index,int level){ if(v[index].child.size() == 0) return; cnt[level]+=

2020-05-18 15:45:11 141

原创 PAT甲级1017:Queuing At Bank

#include <bits/stdc++.h>using namespace std;int MAX=10005;struct Person{ int come,time;};bool cmp(Person a,Person b){ return a.come<b.come;}int main(){ int m,n,cnt=0,total=0; cin >> m >> n; struct Person p

2020-05-16 16:31:03 88

原创 PAT甲级1146

#include <iostream>#include <vector>using namespace std;int main() { int n, m, a, b, k, flag = 0, in[1010]; vector<int> v[1010]; scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) { scanf("%d %d", &a

2020-05-08 23:02:57 99

原创 PAT甲级1089

参考文章#include<iostream>#include<algorithm>#include<string.h>using namespace std; bool is(int num1[], int num2[], int n){ for (int i = 0; i < n; i++) if (num1[i] != num2[i])...

2020-05-07 21:53:45 108

原创 PAT甲级:1085 perfect sequence

注意upper_bound 和lower_bound函数的用法自己写的一个测试数据错误#include <bits/stdc++.h>using namespace std;int main(){ vector<long> v; long m,p; cin >> m >> p; for(int i=0;i&...

2020-05-06 21:38:23 73

原创 二叉树已知中序、后序求层次遍历

后序:8 9 4 10 5 2 6 7 3 1中序:8 4 9 2 10 5 1 6 3 7思路1、i节点的左孩子可以表示为:2i+1,右孩子可以表示为:2i;2、后序的最后一个节点为根节点,在中序中找到根节点所在的位置index,这样index左面全部为左子树,右面全部为右子树,再用同样的方法递归,3、第一次递归的结果为所有的左孩子节点的值放入map中,第二次遍历为所有的右孩子,放入...

2020-04-22 21:41:29 1031 1

原创 二叉树根据两种顺序求另外一种顺序

参考文章链接#include <iostream>#include <vector>#include <string>using namespace std;vector <char > post;string pre, mid;string ans;//知先序中序求后序void solve(int l1, int r1, in...

2020-04-22 16:14:02 152

原创 PAT甲级(1066):Root of AVL Tree

#include <bits/stdc++.h>using namespace std;struct node { int val; struct node *left, *right;};node *rr_rotate(node *root) { node *t = root -> right; root -> right = t ...

2020-04-19 22:35:07 72

原创 平衡二叉树(C++实现)

参考连接:https://blog.csdn.net/isunbin/article/details/81707606#include<stdio.h>#include<stdlib.h> typedef struct Node{ int key; struct Node *left; struct Node *right; int...

2020-04-19 21:58:21 157

原创 二叉排序树

参考连接:https://blog.csdn.net/Sungree/article/details/101167476#include <stdio.h>#include <stdlib.h>typedef struct BST{ int key; struct BST *lchild; struct BST *rchild;}BST;...

2020-04-18 22:35:18 115

原创 二叉树的创建与遍历(C语言)

#include<stdio.h>#include<stdlib.h>typedef struct BiTNode{ char data; struct BiTNode *lchild,*rchild;}BiTNode,*BiTree;void PreOrderTraverse(BiTree T)//二叉树的先序遍历{ if(T==NUL...

2020-04-18 09:49:37 469

原创 二叉树的创建和三种遍历方法(Java)

package tree;import java.util.ArrayList;import java.util.List;public class VisitTree { public static void main(String[] args) { TreeNode[] nodes = new TreeNode[10]; //创建二叉树 for(in...

2020-04-17 10:44:14 175

原创 PAT甲级(1061):Scientific Notation

(1)、find()函数 string name="dddfsfs"; int index = name.find('d'); //返回d第一次出现时的下标(2)、insert函数 a = str.insert(4,"sky"); //在下标为4的位置,插入字符串sky b = str.insert(4,5,'x'); //在下标为4的位置,插入字符串5个字...

2020-04-15 09:58:04 78

原创 PAT甲级(21):Shopping In Mars

双指针参考链接:https://blog.csdn.net/richenyunqi/article/details/793237961、首先将i和j都指向0下标,sum为i到j的和。2、如果sum小于x的话j就向右移动。3、如果sum=x的话输出。4、如果sum>x的话,就将最小和maxNum设置为sum,并且将i+1和j加入vector,如果sum<maxNum的话就将v清...

2020-04-13 10:39:11 67

原创 PAT(20):Foreards On Weibo

#include<iostream>#include<cstdio>#include<cstring>#include<queue>using namespace std;const int maxn = 1200;int a[maxn][maxn],vis[maxn],len,n;queue <int> q;int bf...

2020-04-10 11:04:20 77

原创 有向图、无向图的深度(广度)优先搜索

图邻接矩阵代码package test;import java.util.LinkedList;import java.util.Queue;import java.util.Scanner;/** * 无向图的DFS和BFS * @author 鹏鹏 * */@SuppressWarnings("all")public class Graph1 { priva...

2020-04-09 10:58:32 897

原创 PAT甲级(19):The World's Richest

第一次一个测试用例超出内存限制#include <iostream>#include <vector>#include <algorithm>using namespace std;struct people{ string name; int age; int money;};struct cases{ int...

2020-04-07 11:06:08 62

原创 PAT甲级(18):Be Unique

#include <iostream>#include <map>using namespace std;int main(){ int n; bool flag = false; map<int,int> m; cin >> n; int a[n]; for(int i=0;i<n;i+...

2020-04-07 09:13:04 72

原创 PAT甲级(17):Find Coins

第一次尝试:两个测试用例运行超时#include <iostream>#include <algorithm>#include <cstdio>using namespace std;int N,M,v1=1000,v2=1000;int main(){ scanf("%d %d",&N,&M); int a[N];...

2020-04-06 10:10:54 75

原创 PAT(16):Median

自己写的部分报错(想的太简单)#include <iostream>#include <algorithm>#include <vector>using namespace std;int main(){ vector<int> v; int length, a; for(int j=0;j<2;j++) ...

2020-04-05 10:52:02 73

原创 PAT(15):1009 Product of Polynomials

特别注意t的用处#include<iomanip>#include<iostream>#include <algorithm>using namespace std;int main(){ int n, m; float numa[1001] = {0.0};//存放A中的各项信息,下标是指数,数组的值是对应的系数 float numb[...

2020-04-04 22:46:16 47

杭州端点公司java面试题.md

杭州端点公司java面试题

2021-01-31

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除