- 15
- 0
- 约1.86万字
- 约 20页
- 2017-06-10 发布于河南
- 举报
java编程题90道(国外英文资料)
java编程题90道(国外英文资料)
Complete array int [] a = {100, 40, 60, 87, 34, 11, 56, 0} quicksort, bubble sort;
1) quick sort
Package the SRC;
/ *
* there are several key points
* what is the middle value of * 1
* what is the comparison between the two I and j
What is the left and right value of the recursive call
* /
Public class QuickSort {/ / QuickSort
Public static void main (String [] args)
Int [] a = {100, 40, 60, 87, 34, 11, 56, 0};
Int left = 0;
Int right = a.l ength - 1;
QuickSort (a, left, right);
/ / the loop displays the array
For (int I = 0; I a.ength; I + +) {
The System is out of order.
}
}
Public static void quickSort (int [] a, int left, int right) {
Int middle, temp;
Int I = left;
Int j = right;
Middle = a [left];
While (I j) {
While (a [I] middle).
I++;
}
(a [j] , middle) and (j , left))
J --;
}
If (I = j) {
Temp = a [I];
A [I] = a [j];
A [j] = temp;
I++;
J --;
}
}
If (left j) {
QuickSort (a, left, j);
}
If (right I)
QuickSort (a, I, right);
}
}
}
2) bubble sort
Package the SRC;
Public class PopSort {
Public static void main (String [] args)
Int [] a = {100, 40, 60, 87, 34, 11, 56, 0};
For (int I = 0; I a.i.ength; I + +)
For (int j = 0; j)
If (a [j] a [j + 1]) {...
Int temp = a [j];
A [j] = a [j + 1];
A [j + 1] = temp;
}
}
For (int k = 0; k a.ength; k + +) {.
A. out.print (a [k] + );
}
}
}
Using a semi-lookup algorithm, query to a certain number in an array;
In the Chinese context, there are strings that sum up the data of each byte.
Get rid of the value = 0 in an array, and store a new array of values that are not 0, such as:
Int a [] = {1, 3, 4, 5, 0, 0, 6, 6, 6, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 6, 7, 7,
The generated new array is:
Int b [] = {1, 3, 4, 5, 6, 6, 5, 4, 7, 6, 7, 5}
Define 10 length Student arrays, add 1 to the age of 10 Student objects, and print out the details of 10 Student objects (array and ArrayList implementation).
}
6. There are workers, farmers, teachers, scientists, waiter, among them, workers, farmers, the wait
您可能关注的文档
- arm课堂笔记(国外英文资料).doc
- asa5520常用配置(国外英文资料).doc
- ADSL路由器NAT设置(国外英文资料).doc
- ASCII_UNICODE_UTF8字符串互相转换的C++代码(国外英文资料).doc
- ASM 磁盘、目录的管理(国外英文资料).doc
- Atmega2560 按键功能 程序(国外英文资料).doc
- ATX电源(国外英文资料).doc
- 74系列集成电路名称与功能(国外英文资料).doc
- AVR控制矩阵键盘,12864显示简单计算器(国外英文资料).doc
- AWOS 题库基础知识部分(选择题)(国外英文资料).doc
- 中国国家标准 GB/T 16172-2026建筑材料热释放速率和产烟速率试验方法.pdf
- GB/T 16172-2026建筑材料热释放速率和产烟速率试验方法.pdf
- 《GB/T 16172-2026建筑材料热释放速率和产烟速率试验方法》.pdf
- 《GB/T 14926.62-2026实验动物 猴免疫缺陷病毒检测方法》.pdf
- GB/T 14926.62-2026实验动物 猴免疫缺陷病毒检测方法.pdf
- GB/T 46917.3-2026标准语义知识库 第3部分:语义集成技术要求.pdf
- 《GB/T 46917.3-2026标准语义知识库 第3部分:语义集成技术要求》.pdf
- 中国国家标准 GB/T 46917.3-2026标准语义知识库 第3部分:语义集成技术要求.pdf
- 中国国家标准 GB/T 45305.3-2026声学 建筑构件隔声的实验室测量 第3部分:撞击声隔声测量.pdf
- GB/T 45305.3-2026声学 建筑构件隔声的实验室测量 第3部分:撞击声隔声测量.pdf
原创力文档

文档评论(0)