摘要:
伪代码: A: 数组名 n: 数组长度 BUBBLE-SORT(A, n) for i = 0 to n-2 for j = 0 to n-2-i if A[j] > A[j+1] swap A[j] with A[j+1] void bubbleSort(int A[], int n) { for 阅读全文
posted @ 2025-03-31 19:54 steve.z 阅读(7) 评论(0) 推荐(0)
|
摘要:
伪代码: A: 数组名 n: 数组长度 BUBBLE-SORT(A, n) for i = 0 to n-2 for j = 0 to n-2-i if A[j] > A[j+1] swap A[j] with A[j+1] void bubbleSort(int A[], int n) { for 阅读全文
posted @ 2025-03-31 19:54 steve.z 阅读(7) 评论(0) 推荐(0)
摘要:
伪代码: A: 数组名 n: 数组长度 SELECTION-SORT(A, n) for i = 0 to n-2 min_idx = i for j = i+1 to n-1 if A[j] < A[min_idx] min_idx = j if min_idx != i swap A[i] wi 阅读全文
posted @ 2025-03-31 19:45 steve.z 阅读(23) 评论(0) 推荐(0) |
||