⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectsort1.txt

📁 selection排序法
💻 TXT
字号:
//**************************************
//     
// Name: Select Sort
// Description:This will sort an array o
//     f integers using the select sort algorit
//     hm.
// By: MaLord
//
// Inputs:An array of integers and the n
//     umber of items in the array.
//

void select_sort(int array[], int size)


    {
    //Go through the array comparing every n
    //     umber
    //with every number after it, 
    //if the first number is bigger then swa
    //     p the data
    for (int i = 0; i < size-1)


        {
        for (int compare = i+1; compare < size; compare++)


            {
            if (array[i] > compare[i])
            swap(array[i], compare[i]);
        }
    }
}
void swap(int &first, int &second)


    {
    //For a swap, a temporary variable must 
    //     be used
    int temp = first;
    first = second;
    second = temp;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -