C language selection sorting implementation source code and demo animation

C language selection sorting implementation source code and demo animation

void selection_sort(int arr[], int len) 
{
    int i, j, min;
    for (i = 0; i < len - 1; i++) {
        min = i;
        for (j = i + 1; j < len; j++) {
            if (arr[j] < arr[min]) {
                min = j;
            }
            swap(&arr[min], &arr[i]);
        }
    }
}

demo animation




Comments

Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example