bubble.gml

来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 22 行

GML
22
字号
void BubbleSort( int list[], int n )
/**********************************/
{
    int index1 = 0;

    if( n < 2 )return;
    do {
        int index2;

        index2 = index1 + 1;
        do {
            int temp;

            if( list[ index1 ] > list[ index2 ] ) {
                temp = list[ index1 ];
                list[ index1 ] = list[ index2 ];
                list[ index2 ] = temp;
            }
        } while( ++index2 < n );
    } while( ++index1 < n-1 );
}

⌨️ 快捷键说明

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