Skip to content

Commit 7cdb216

Browse files
committed
Java
1 parent a2eb966 commit 7cdb216

File tree

9 files changed

+597
-0
lines changed

9 files changed

+597
-0
lines changed

docs/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@
179179
- [第七节 动态规划](LeetCode/算法思想相关/7_动态规划.md)
180180
- [第八节 数学问题](LeetCode/算法思想相关/8_数学问题.md)
181181

182+
## 3. 考研机试编程题
183+
184+
185+
186+
187+
182188
# 💾 数据库
183189

184190
## 1. DataBase

docs/kaoyan/1_基础题目.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# 基础题目
2+
3+
## 排序问题
4+
5+
### [1、常见排序算法](../data_structure/10_排序.md)
6+
7+
[排序](https://www.nowcoder.com/practice/508f66c6c93d4191ab25151066cb50ef?tpId=69&tqId=29657&tPage=1&ru=/kaoyan/retest/11002&qru=/ta/hust-kaoyan/question-ranking)
8+
9+
```java
10+
//思路:这里使用选择排序
11+
import java.util.Scanner;
12+
13+
public class Main {
14+
public static void main(String[] args) {
15+
Scanner sc=new Scanner(System.in);
16+
int n=sc.nextInt();
17+
int[] arr=new int[n];
18+
for(int i=0;i<n;i++){
19+
arr[i]=sc.nextInt();
20+
}
21+
selectionSort(arr);
22+
for(int i=0;i<n;i++){
23+
System.out.print(arr[i]+" ");
24+
}
25+
System.out.println();
26+
}
27+
28+
//选择排序
29+
private static void selectionSort(int[] arr){
30+
int N = arr.length;
31+
int minIndex = -1;
32+
for(int i=0;i<N;i++){ // arr[i] 是当前元素
33+
minIndex=i;
34+
for(int j=i+1;j<N;j++){ //arr[j] 当前元素后面的元素
35+
if(arr[j]<arr[minIndex]){
36+
minIndex=j;
37+
}
38+
}
39+
if(minIndex==i){ //TODO:这里有个小优化:如果当前元素是最小的则不用交换了
40+
continue;
41+
}
42+
swap(arr,minIndex,i);
43+
}
44+
}
45+
46+
private static void swap(int[] arr,int i,int j){
47+
int tmp = arr[i];
48+
arr[i] = arr[j];
49+
arr[j] = tmp;
50+
}
51+
}
52+
```
53+
54+
55+
56+
### 2、奥运排序问题
57+
58+
[奥运排序问题](https://www.nowcoder.com/practice/100a4376cafc439b86f5f8791fb461f3?tpId=63&tqId=29564&tPage=1&ru=/kaoyan/retest/9001&qru=/ta/zju-kaoyan/question-ranking)
59+
60+
```java
61+
62+
```
63+
64+
65+
66+
### 3、成绩排序
67+
68+
[成绩排序](https://www.nowcoder.com/practice/0383714a1bb749499050d2e0610418b1?tpId=60&tqId=29474&tPage=1&ru=/kaoyan/retest/1001&qru=/ta/tsing-kaoyan/question-ranking)
69+
70+
```java
71+
72+
```
73+
74+
75+
76+
## 查找
77+
78+
### 1、找x
79+
80+
[找 x](https://www.nowcoder.com/practice/069e2130430c41229ab25e47fa0949a6?tpId=40&tqId=21489&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking)
81+
82+
```java
83+
84+
```
85+
86+
87+
88+
### 2、查找学生信息
89+
90+
[查找学生信息](https://www.nowcoder.com/practice/fe8bff0750c8448081759f3ee0d86bb4?tpId=40&tqId=21358&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking)
91+
92+
```java
93+
94+
```
95+
96+
97+
98+
## 日期处理
99+
100+
### 1、日期差值
101+
102+
[日期差值](https://www.nowcoder.com/practice/ccb7383c76fc48d2bbc27a2a6319631c?tpId=62&tqId=29468&tPage=2&ru=/kaoyan/retest/2002&qru=/ta/sju-kaoyan/question-ranking)
103+
104+
```java
105+
106+
```
107+
108+
109+
110+
### 2、Day of Week
111+
112+
[Day of Week](https://www.nowcoder.com/practice/a3417270d1c0421587a60b93cdacbca0?tpId=40&tqId=21439&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking)
113+
114+
```java
115+
116+
```
117+
118+
119+
120+
## Hash的使用
121+
122+
### 1、统计同成绩学生人数
123+
124+
[统计同成绩学生人数](https://www.nowcoder.com/practice/987123efea5f43709f31ad79a318ca69?tpId=40&tqId=21467&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking)
125+
126+
```java
127+
128+
```
129+
130+
131+

docs/kaoyan/2_字符串处理.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 字符串处理
2+
3+
## 字符与数组
4+
5+
### 1、统计字符
6+
7+
[统计字符](https://www.nowcoder.com/practice/4ec4325634634193a7cd6798037697a8?tpId=63&tqId=29574&tPage=1&ru=/kaoyan/retest/9001&qru=/ta/zju-kaoyan/question-ranking)
8+
9+
```java
10+
11+
```
12+
13+
## 字符与整数
14+
15+
### 1、字符串的反码
16+
17+
[字符串的反码](https://www.nowcoder.com/practice/01b7dae14d1b464db5f9259e90d9a35e?tpId=65&tqId=29619&tPage=1&ru=/kaoyan/retest/4001&qru=/ta/jlu-kaoyan/question-ranking)
18+
19+
```java
20+
21+
```
22+
23+
24+
25+
## 巧用初始化与巧用存放位置
26+
27+
### 1、首字母大写
28+
29+
[首字母大写](https://www.nowcoder.com/practice/91f9c70e7b6f4c0ab23744055632467a?tpId=61&tqId=29529&tPage=2&ru=/kaoyan/retest/1002&qru=/ta/pku-kaoyan/question-ranking)
30+
31+
```java
32+
33+
```
34+
35+
36+
37+
## 字符串内部操作
38+
39+
### 1、回文字符串
40+
41+
[回文字符串](https://www.nowcoder.com/practice/df00c27320b24278b9c25f6bb1e2f3b8?tpId=69&tqId=29674&tPage=2&ru=/kaoyan/retest/11002&qru=/ta/hust-kaoyan/question-ranking)
42+
43+
```java
44+
45+
```
46+
47+
48+
49+
## 字符串处理函数的应用
50+
51+
### 1、最长&最短文本
52+
53+
[最长&最短文本](https://www.nowcoder.com/practice/3331d16fe07d4358858178ff5fa73e0d?tpId=69&tqId=31041&tPage=2&ru=/kaoyan/retest/11002&qru=/ta/hust-kaoyan/question-ranking)
54+
55+
```java
56+
57+
```
58+
59+
60+
61+
## 数值转换
62+
63+
### 1、字符串的查找删除
64+
65+
[字符串的查找删除](https://www.nowcoder.com/practice/a591300637874f6ba2316a5fe3e94579?tpId=66&tqId=29631&tPage=1&ru=/kaoyan/retest/1004&qru=/ta/buaa-kaoyan/question-ranking)
66+
67+
```java
68+
69+
```

0 commit comments

Comments
 (0)