Skip to content

Commit 04315df

Browse files
committed
JAVA 知识体系
1 parent e761870 commit 04315df

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
- [TCP三次握手和四次挥手的流程,为什么断开连接要4次,如果握手只有两次,会出现什么。](https://blog.csdn.net/qzcsu/article/details/72861891)
135135
- TIME_WAIT和CLOSE_WAIT的区别。
136136
- [说说你知道的几种HTTP响应码,比如200, 302, 404。](https://blog.csdn.net/ddhsea/article/details/79405996)
137-
- 当你用浏览器打开一个链接(如:http://www.baidu.com)的时候,计算机做了哪些工作步骤。
137+
- [当你用浏览器打开一个链接的时候,计算机做了哪些工作步骤。](https://segmentfault.com/a/1190000006879700)
138138
- [TCP/IP如何保证可靠性,说说TCP头的结构。](https://blog.csdn.net/liuchenxia8/article/details/80428157)
139139
- 如何避免浏览器缓存。
140140
- [如何理解HTTP协议的无状态性。](https://blog.csdn.net/tennysonsky/article/details/44562435)

src/main/java/com/algorithm/study/demo/LRUCache/LRULinked.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public class LRULinked{
1919
public LRULinked(int cacheSize){
2020
this.cacheSize=cacheSize;
2121
}
22-
2322
/**
2423
* 插入头结点
2524
* @param value
@@ -63,17 +62,12 @@ public int get(int key){
6362
@Override
6463
public String toString(){
6564
StringBuilder sb=new StringBuilder();
66-
int j=0;
67-
Node temp=root;
68-
while (j<size){
65+
for (Node temp=root;temp!=null;temp=temp.next){
6966
sb.append(temp.value);
70-
temp= temp.next;//找到最后一个结点
71-
j++;
7267
}
7368
return sb.toString();
7469
}
75-
76-
public static class Node{
70+
class Node{
7771
private Integer key;
7872
private Integer value;
7973
private Node next;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.algorithm.study.demo.algorithm;
2+
3+
/**
4+
* @Author: liuxun
5+
* @CreateDate: 2019/2/13 下午3:11
6+
* @Version: 1.0
7+
*/
8+
public class Solution {
9+
10+
/**
11+
* 整数反转
12+
* 给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。
13+
* @param x
14+
* @return
15+
*/
16+
public static int reverse(int x) {
17+
long result = 0;
18+
while (x != 0) {
19+
result = result * 10 + x % 10;
20+
x /= 10;
21+
}
22+
if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE)
23+
result = 0;
24+
return (int)result;
25+
}
26+
}

src/main/java/com/algorithm/study/demo/algorithm/Suanfa50.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
public class Suanfa50 {
1212
public static void main(String[] args) {
13-
printMissingNumber(new int[]{1, 3, 6}, 6);
13+
// printMissingNumber(new int[]{1, 3, 6}, 6);
1414
}
1515
private static void printMissingNumber(int[] numbers, int count) {
1616
int missingCount = count - numbers.length;
@@ -30,4 +30,6 @@ private static void printMissingNumber(int[] numbers, int count) {
3030
}
3131

3232
}
33+
34+
3335
}

0 commit comments

Comments
 (0)