自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(169)
  • 收藏
  • 关注

原创 面试可能问的问题3

1.读写分离1.读写分离的前提是,mysql做了主从,也就是一主多从或者多主多从的结构为什么要做读写分离?1.应用的第一个瓶颈一定是在数据库(磁盘上的读写速度是最慢的)2.写操作会加锁,也就是在进行读操作时必须等写操作完成之后再进行,加大的拖累了程序的运行速度3.基本上所有的应用都是读多写少2.MYSQL主从复制原理mysql主从复制的基础是bin-log日志,slave通过一个I/O线程与主服务器保持通信,并监控master的二进制日志文件的变化,如果发现master二进制日志发生变化,则会

2022-02-14 09:38:14 185

原创 面试可能问的问题2---新闻列表

步骤分析1.首页列表实现,每一个标签只显示5条最新的数据,查询条件中根据标签查询,每次切换标签都访问一个接口2.列表查询sql语句,只查询题目以及id,提高查询性能3.查询出结果后,放入redis缓存中,设置2分钟的过期时间,加快访问速度的同时也可以防止出现集中访问的情况,应对短暂的热点现象4.文章详情,根据id查询文章的详细信息,同样放入缓存中,考虑到文章内容过大,设计30s的过期时间,后期如果出现访问激增的情况,考虑放入es中5.列表详情页面,分页查询,同样放入缓存,sql语句只查询需要的信息

2022-02-12 12:44:26 261

原创 面试可能问的东西1

1.介绍下sso这里有个优化策略,就是每次去系统A或者系统B,他们验证都需要去sso认证中心进行认证,浪费网络资源,如果能够生成一个系统A的tocken或者系统B的tocken则就不用每次去sso认证中心进行认证2.介绍下jwt技术:1.jwt技术生成一个加密的tocken,作为用户登陆的令牌,当用户登陆成功后,发送给客户端,请求需要登陆的资源或者接口,需要携带tocken,通过后端进行验证tocken是否合法2.jwt有3部分组成:1.指定签名,固定好的{‘type’:‘JWT’,‘alg

2022-02-11 16:31:50 254

原创 java基础--反射机制

例子1Personpackage com.atguigu.java3;/** * @author shkstart * @create 2021-12-{DAY} 20:06 */public class Person { private String name; public int age; public Person() { } public Person(String name, int age) { this.name

2021-12-20 20:50:51 101

原创 java基础--IO流

例子1package com.atguigu.java3;import org.junit.Test;import java.io.File;/** * @author shkstart * @create 2021-12-{DAY} 21:27 */public class FileTest { @Test public void test1(){ //构造器1 File file1 = new File("hello.txt");

2021-12-17 15:50:11 411

原创 java基础--泛型

/** * @author shkstart * @create 2021-12-{DAY} 18:23 */public class GenericTest { //在集合中使用泛型之前的情况 @Test public void test1(){ ArrayList list = new ArrayList

2021-12-15 18:51:01 387

原创 jdbc学习

1.连接数据库package com.atguigu.java;import org.junit.Test;import java.sql.Connection;import java.sql.Driver;import java.sql.DriverManager;import java.sql.SQLException;import java.util.Properties;/** * @author shkstart * @create 2021-12-{DAY} 14:48

2021-12-01 15:15:02 1087

原创 面向对象下

例子1package com.atguigu.java3;/** * @author shkstart * @create 2021-11-{DAY} 20:51 */public class StaticTest { public static void main(String[] args) { Chinese c1 = new Chinese(); c1.name="马云"; c1.age=40; Chinese

2021-11-22 21:14:25 210

原创 面向对象中

例子1Person类package com.atguigu.java1;/** * @author shkstart * @create 2021-11-{DAY} 19:38 */public class Person { String name; int age; public Person(){ } public Person(String name,int age){ this.name=name; thi

2021-11-16 19:39:08 180

原创 java基础--面向对象(上)

例子1package com.atguigu.java;/** * @author shkstart * @create 2021-11-{DAY} 20:19 */public class InstanceTest { public static void main(String[] args) { Phone p = new Phone(); p.sendEmail(); p.playGame(); //匿名对象,

2021-11-15 20:29:14 241

原创 MySQL笔记

@@

2021-11-15 16:48:37 802

原创 java集合

例子1

2021-11-02 21:29:53 81

原创 java-枚举类

例子1

2021-11-02 18:24:19 66

原创 java基础--常用类

例子1package com.atguigu.java;import org.junit.Test;/** * String的使用 * @author shkstart * @create 2021-10-{DAY} 18:31 */public class StringTest { /* String:字符串,使用一对""引起来表示 */ @Test public void test1(){ String s1 = "abc

2021-10-28 19:02:47 89

原创 java基础---多线程

例子1package com.atguigu.java;/** * @author shkstart * @create 2021-10-{DAY} 18:02 *///1.创建一个继承于Thread类的子类 class MyThread extends Thread { //2.2.重写Thread类的run()方法 @Override public void run() { for (int i = 0; i < 100; i++)

2021-10-25 19:13:51 103

原创 java异常处理

例子1/** * */package com.atguigu.java;/** * @Descripton * @author wsf Email:2181821498@qq.com * @version * @date 2021年10月20日下午5:19:46 * */public class ErrorTest { public static void main(String[] args) { //1.栈溢出 java.lang.StackOverflowError

2021-10-20 17:23:40 101

原创 java内部类

例子1:成员内部类和局部内类/** * */package com.atguigu.java2;/* * * * */public class InterClassTest { }class Person{ //静态成员内部类 static class Dog{ String name; int age; public void show(){ System.out.println("卡拉是条狗"); } } //非静态成员内部

2021-10-19 21:16:34 67

原创 java接口interface

/** * */package com.atguigu.java1;/** * @Descripton * @author wsf Email:2181821498@qq.com * @version * @date 2021年10月19日下午5:02:07 * */public class InterfaceTest { public static void main(String[] args) { System.out.println(Flyable.MAX_SPEE

2021-10-19 17:12:35 106

原创 askldjf

/** * */package com.atguigu.java;/* * * * */public class AbstractTest { public static void main(String[] args) { //一旦Person类抽象了,就不可实例化 Person p1 = new Person(); p1.eat(); }}abstract class Person{ String name; int age;

2021-10-16 19:00:53 127

原创 pat-高精度

A+B for Polynomials这道题就是有个坑是对于多项式,如果底数为0,则不需要输出#include<bits/stdc++.h>using namespace std;int main(){ map<int,double> mp; vector<pair<int,double>> res; int n,m; cin >> n; for(int i=0; i<n; i++)

2021-09-16 12:06:13 78

原创 语法知识点

1.设置指定长度和内容的字符串#include<bits/stdc++.h>using namespace std;int main(){ string s=string(3,'2'); cout << s;}

2021-09-15 14:24:41 66

原创 pat题库--字符串

1071 Speech Patterns#include<bits/stdc++.h>using namespace std;bool check(char c){ if('a'<=c && c<='z') return true; if('A'<=c && c<='Z') return true; if('0'<=c && c<='9')

2021-09-14 12:26:33 123

原创 拓扑排序总结

有向图的拓扑排序//因为我们最后要输出的是拓扑序列,所以bfs的时候用数组比较合适//最后比较是tt==n-1,true为拓扑序列;false为不是bool tuopu(){ int hh=0,tt=-1; for(int i=1; i<=n; i++) if(!d[i]) q[++tt]=i; while(hh<=tt) { int t=q[hh++]; for(int i=h[t

2021-09-07 15:15:45 166

原创 PAT(甲级)2019年春季考试

7-2 Anniversary#include<iostream>#include<set>using namespace std;const int maxn=100010;int n,m;set<string> s1,s2;int main(){ cin >> n; for(int i=0; i<n; i++) { string s; cin >> s;

2021-08-26 11:47:35 81

原创 pat甲级真题分类--双指针

Group Photo#include <iostream>#include <cstring>#include <cmath>#include <vector>#include <algorithm>using namespace std;const int MAX_N = 10010;const int MAX_K = 11;int group[MAX_K][MAX_N];struct People { cha

2021-08-11 15:04:08 90

原创 pat甲级真题分裂--并查集

1Birds in Forest #include<iostream>using namespace std;const int maxn=10010;int n,cnt;bool st[maxn];int birds[maxn],p[maxn];int find(int x){ if(x!=p[x]) p[x]=find(p[x]); return p[x];}int main(){ cin >> n;

2021-08-10 11:24:39 87

原创 pat甲级真题分类-树

Is It A Red-Black Tree/*判断一个树是否为红黑树:1.根节点是黑色2.节点是红色,左右儿子都是黑色3.从一个节点出发到叶子结点,其路径上黑色点的数量是相同的*/#include<iostream>#include<unordered_map>#include<cmath>#include<algorithm>using namespace std;const int maxn=33;int T;boo

2021-08-05 16:06:13 100

原创 pat甲级真题分类--图论

Vertex Cover#include<iostream>#include<cstring>using namespace std;const int maxn=10010;int n,m;bool st[maxn];struct node{ int a,b;}Node[maxn];int main(){ cin >> n >> m; for(int i=0; i<m; i++)

2021-08-05 11:13:13 104

原创 pat甲级真题分类--模拟链表

7-2 Block Reversing (25 分)Given a singly linked list L. Let us consider every K nodes as a block (if there are less than K nodes at the end of the list, the rest of the nodes are still considered as a block). Your job is to reverse all the blocks in L. Fo

2021-07-19 15:15:07 120

原创 pat甲级真题分裂-迪杰斯特拉

7-4 Professional Ability Test (30 分)#include<cstdio>#include<queue>#include<string>#include<cstring>#include<unordered_set>/* 首先根据题目意思,这道题分成有环图和无环图,对于有环图来说,如果能直接得到考试,则直接输出directly, 对于其他情况,肯定每次都是从入度为0的点出发,首先找到整个路

2021-07-11 16:43:04 109

原创 pat甲级真题分类-数学问题

7-1 The Closest Fibonacci Number (20 分)#include<bits/stdc++.h>using namespace std;int num[1002]={0,1};int cnt=2;int main(){ int n; cin>>n; //读入一个n while(1) //死循环 { num[cnt]=num[cnt-1]+num[cnt-2]

2021-07-11 16:39:35 121

原创 pat甲级--根据中左,中后序遍历输出

7-3 Left-View of Binary Tree (25 分)The left-view of a binary tree is a list of nodes obtained by looking at the tree from left hand side and from top down. For example, given a tree shown by the figure, its left-view is { 1, 2, 3, 4, 5 }Given the inord..

2021-07-09 12:08:51 173 2

原创 pat甲级--水题

7-2 How Many Ways to Buy a Piece of Land (25 分)The land is for sale in CyberCity, and is divided into several pieces. Here it is assumed that each piece of land has exactly two neighboring pieces, except the first and the last that have only one. One can

2021-07-09 11:34:01 71

原创 pat甲级真题分类-dfs

7-4 Chemical Equation (30 分)A chemical equation is the symbolic representation of a chemical reaction in the form of symbols and formulae, wherein the reactant entities are given on the left-hand side and the product entities on the right-hand side. For

2021-07-04 11:36:40 333

原创 pat甲级真题分类-逻辑处理

7-3 File Path (25 分)The figure shows the tree view of directories in Windows File Explorer. When a file is selected, there is a file path shown in the above navigation bar. Now given a tree view of directories, your job is to print the file path for any

2021-07-04 11:14:54 246 1

原创 pat甲级真题分类--字符串处理

7-2 Subsequence in Substring (25 分)A substring is a continuous part of a string. A subsequence is the part of a string that might be continuous or not but the order of the elements is maintained. For example, given the string atpaaabpabtt, pabt is a subst

2021-07-04 11:13:41 145

原创 pat真题词汇积累

siblings 兄弟(siblings)节点ascending 上升的common difference(公差)

2021-07-04 07:33:03 90

原创 pat甲级真题分类--Floyd算法

给出任意两个点之间距离,用Floyd可以判断这个图是否是联通的,还能求出遍历这个图所需要的最短路径//题目的意思是给出任意两点之间的距离,如果这个图是联通的,则输出遍历的路径,并且输出遍历路径的距离;如果不是联通的,第1行输出正常的访问路径,第2行输出没访问过的点#include<iostream>#include<cstring>#include<vector>using namespace std;const int maxn=205;int e[m

2021-07-03 16:16:20 142

原创 pat甲级真题分类--大根堆

7-2 Lab Access Scheduling (25 分)Nowadays, we have to keep a safe social distance to stop the spread of virus due to the COVID-19 outbreak. Consequently, the access to a national lab is highly restricted. Everyone has to submit a request for lab use in adv

2021-07-03 15:18:53 172

原创 pat真题分类---贪心

2021春季7-2 Lab Access Scheduling//这道题完全等同于 最大不相交区间的数量 这不过这道题 (包含端点相交)#include<iostream>#include<algorithm>using namespace std;const int maxn=2010;struct node{ int l,r; bool operator<(const node &t)const { r

2021-07-03 11:53:45 85

空空如也

空空如也

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

TA关注的人

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