ALPRO2-6 Data Structure and Sorting
ALPRO2-6 Data Structure and Sorting
http://btv.melezinek.cz/home.html
Ascending
0 1 2 3 4 5 6 7 8 9
Descending
9 8 7 6 5 4 3 2 1 0
34 67 23 28 98 15 89 67 28 18
34 67 23 28 98 15 89 67 28 18
23 34 67 28 98 15 89 67 28 18
23 34 67 28 98 15 89 67 28 18
23 28 34 67 98 15 89 67 28 18
23 28 34 67 98 15 89 67 28 18
23 28 34 67 98 15 89 67 28 18
23 28 34 67 98 15 89 67 28 18
15 23 28 34 67 98 89 67 28 18
15 23 28 34 67 98 89 67 28 18
15 23 28 34 67 89 98 67 28 18
15 23 28 34 67 67 89 98 28 18
15 23 28 34 67 67 89 98 28 18
15 23 28 28 34 67 67 89 98 18
15 23 28 28 34 67 67 89 98 18
15 18 23 28 28 34 67 67 89 98
15 18 23 28 28 34 67 67 89 98
int main()
Programming {
int tabInt[10]={34,67,23,28,98,15,89,67,28,18};
int i;
int data_sisip;
int j;
tabInt[j+1] = data_sisip;
}
tampilArray(10, tabInt);
return 0;
}
34 67 23 28 98 15 89 67 28 18
15 67 23 28 98 34 89 67 28 18
15 67 23 28 98 34 89 67 28 18
15 18 23 28 98 34 89 67 28 67
15 18 23 28 98 34 89 67 28 67
15 18 23 28 98 34 89 67 28 67
15 18 23 28 98 34 89 67 28 67
15 18 23 28 98 34 89 67 28 67
15 18 23 28 98 34 89 67 28 67
15 18 23 28 28 34 89 67 98 67
15 18 23 28 28 34 89 67 98 67
15 18 23 28 28 34 89 67 98 67
15 18 23 28 28 34 67 89 98 67
15 18 23 28 28 34 67 89 98 67
15 18 23 28 28 34 67 67 98 89
15 18 23 28 28 34 67 67 98 89
15 18 23 28 28 34 67 67 89 98
15 18 23 28 28 34 67 67 89 98
int main()
Programming {
int tabInt[10]={34,67,23,28,98,15,89,67,28,18};
int i;
int temp;
int minIndeks;
int j;
tabInt[minIndeks] = temp;
}
tampilArray(10, tabInt);
return 0;
}
printf("Selection Sort\n");
34 67 23 28 98
34 23 67 28 98
34 23 67 28 98
34 23 28 67 98
34 23 28 67 98 23 28 34 67 98
34 23 28 67 98
23 34 28 67 98
23 34 28 67 98
23 28 34 67 98
23 28 34 67 98
23 28 34 67 98
int main()
Programming {
int tabInt[5] = {34,67,23,28,98};
int i;
int temp;
int tukar;
do{
tukar = 0;
for(i=0; i<(5-1); i++){
if(tabInt[i] > tabInt[i+1]){
temp = tabInt[i];
tabInt[i] = tabInt[i+1];
tabInt[i+1] = temp;
tukar = 1;
}
}
} while(tukar == 1);
tampilArray(5, tabInt);
return 0;
}
printf("Bubble Sort\n");
34 67 23 28 98
i j
i j i j
34 67 23 28 98 23 67 34 28 98
i j i j
23 67 34 28 98 23 28 34 67 98
i j i j
i j
23 28 34 67 98
i j
23 28 34 67 98
34 67 23 28 98
i j
i j i j
34 67 23 28 98 34 28 23 67 98
i j i j
34 67 23 28 98 34 28 23 67 98
i j i j
34 67 23 28 98 23 28 34 67 98
i j i j
Indah Permatasari, M.Kom. 30
23 28 34 67 98
i j
23 28 34 67 98