1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-02-02 18:20:26 +08:00

feat: update

This commit is contained in:
喜欢芝士的妹妹
2023-08-30 23:08:37 +08:00
parent 6d81d1706a
commit f989110774
3 changed files with 6 additions and 17 deletions

View File

@@ -8,7 +8,6 @@ void BinaryInsertSort(ElemType Arr[],int n){
lowIndex=1; // 左侧子表 折半查找起始位置
highIndex=i-1; // 左侧子表 折半查找结束位置
while(lowIndex<=highIndex){
// 左侧有序子表的中间位置角标
@@ -23,7 +22,8 @@ void BinaryInsertSort(ElemType Arr[],int n){
}
}
// 跳出循环需要lowIndex>heightIndex说明待插入位置的角标在heightIndex之后为 heightIndex+1,此时需要将heightIndexi之间的所有元素后移
// 跳出循环需要lowIndex>heightIndex
// 说明待插入位置的角标在heightIndex之后为 heightIndex+1,此时需要将heightIndexi之间的所有元素后移
for(j=i-1;j>highIndex;--j){
Arr[j+1]=Arr[j]

View File

@@ -1,15 +1,11 @@
// 冒泡排序
void BubbleSwapSort(ElemType A[], int n){
for(i=0;i<n-1;i++){
// 当前趟次冒泡是否发生了元素交换初始化为false
bool flag=false;
for(j=n-1;j>i;j--){
if(A[j-1].key>A[j].key){
// 将两个元素A[j-1]、A[j]进行交换,有多种方法
swap(A[j-1],A[j])
// 确认已发生交换
@@ -26,7 +22,6 @@ void BubbleSwapSort(ElemType A[], int n){
/**
* 加减法实现两个元素值互换
*
*/
void swap(int a, int b){
// 此时a为两值的和
@@ -37,10 +32,8 @@ void swap(int a, int b){
a=a-b;
}
/**
* 临时变量实现两个元素值的互换
*
*/
// 临时变量实现两个元素值的互换
void swap(int a,int b){
int temp;
temp=a;

View File

@@ -2,11 +2,7 @@
# 计算机网络
<iframe
src="https://142vip-cn.feishu.cn/mindnotes/OMjpbKakpmQRiinGNEZc0qywng9"
src="https://142vip-cn.feishu.cn/share/base/view/shrcnpso8R4vCid01wmg66hFjae"
width="100%"
height="100%"
frameborder="0"
scrolling="No"
leftmargin="0"
topmargin="0"
height="600px"
/>