插入排序实现

插入排序实现,第1张

#include
using namespace std;

//假设传入的是一个数组类型的数据
template
void Insert_sort(T*array,int size);


int main(){

    int a[] ={31,12,3,1,2,9,8,4,2,6,3};

    cout<<"原始数据:"<(0);
    int j = 0;
    for(int i = 1; i=0;j--){
            if(array[j]>temp_numner){
                array[j+1] = array[j];
            }
            else{
                array[j+1] = temp_numner;
                break;
            }

        }
         if(j < 0 ){
            array[0] = temp_numner;
        }
    }



}

 

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/717233.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-25
下一篇 2022-04-25

发表评论

登录后才能评论

评论列表(0条)

保存