About c language and bubble sort I understand the bubble sort of c language, but it's important I don't know the source code of the process that executes bubble sort Since it is described below, can you tell me the bubble sort process in an easy-to-understand manner? Thank you
include<stdio.h> define N 10 int main(void) { int data[N], target; int i,j,work; int low, high, middle; / * Numerical input / * printf ("Enter 10 numbers. \ N"); for ・ (i = 0; i <N; i ++) scanf("%d",&data[i]); /Alignment/ for(i=0;i<N;-1;i++){ for(j=N-2;j>=i;j--){ if( data[j]> data[j + 1] ){ work = data[j]; ・ Data [j] = data [j + 1]; data[j+1]=work; } } }
Recommended Posts