Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5fe1528

Browse files
【added】基本算法思想
1 parent 0a17a9f commit 5fe1528

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

‎基础知识/(6)排序/(1)冒泡排序(优化版本).txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import java.util.Scanner;
2+
3+
//ð�������˼��ܼ򵥣������Դ˱Ƚ����ڵ�Ԫ�ش�С����С��ǰ�ƣ���ĺ��ƣ�����ˮ�е�����һ������С��Ԫ�ؾ��������ƶ��������ո���ˮ���ϡ�
24
//ð�ݵ�ɦ�临�Ӷȣ�1+2+3+....+(n-1)=n(n-1)/2
5+
//��Ϊÿһ������ʹ������������һ�����ݣ��ھ���n-1������֮���������о���n-1�����ݣ��������������ݵ��������Ǵ��ڵ��������������ݵ�������
6+
//��������ð���������������Ҫ����n-1�������Դ˱��㷨��ɦ�临�ӶȻ���O(n*n)��Ҳ��������һ����Ч���㷨��
37
public class BubbleSort {
48

59
static final int SIZE=10; //�趨�����С

‎基础知识/(6)排序/(2)选择排序(低级版本).txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ package selectSort;
22

33

44
//��ѡ������(����ѡ������):�˴���Ϊ-��С��������
5+
//���������������ҵ���С�ģ�Ȼ��ŵ���һ��λ�á�֮���ٿ�ʣ��Ԫ������С�ģ��ŵ��ڶ���λ�á����Դ����ƣ��Ϳ�������������������l�
6+
//���Ժ�����ķ��֣�ѡ�������ǹ̶�λ�ã���Ԫ�ء�����ڲ�������Ĺ̶�Ԫ����λ�ã�������˼ά��ʽ��
7+
8+
//��Ѱ����С��Ԫ����Ҫһ��ѭ���Ĺ��̣�������������Ҫһ��ѭ���Ĺ��̡�����Զ��׼�������㷨��ɦ�临�Ӷ�Ҳ��O(n*n)�ġ�
9+
//�����ζֵ��n�Ƚ�С������£��㷨���Ա�֤һ�����وٴȣ���n�㹻��ɦ���㷨��Ч�ʻή�͡���������n�������㷨��ɦ�������ܿ졣
510
public class SelectSort {
611
static final int SIZE=10;
712
public static void select(int[]arr){

‎基础知识/(6)排序/(3)直接插入排序.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package insertSort;
22

3-
3+
//��Ҫ�����һ�����У�����ǰ��(n-1) [n>=2] �����Ѿ�����
4+
//��˳��ģ�����Ҫ�ѵ�n�����嵽ǰ����������У�ʹ����n����
5+
//Ҳ���ź�˳��ġ���˷���ѭ����ֱ��ȫ���ź�˳��
6+
//�������Ƚ�(n+2)(n-1)/2�Σ��ƶ�(n+4)(n-1)/2��
47

58
//����㷨��ʹ�������0�ŵ�Ԫ���ݴ浥Ԫ�ͼ����ڱ�����������IJ���ֻ�����������n-1����nΪ���鳤�ȣ���
69
public class InsertSort {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /