Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SWAP : algo d'échange */
- void swap(int iArray[], int index1, int index2)
- {
- int temp;
- temp = iArray[index1];
- iArray[index1] = iArray[index2];
- iArray[index2] = temp;
- }
- /* BUBBLE : classe tableau ordre croissant */
- void bubbleSort(int size, int iArray[])
- {
- int cmpt;
- int isSorted = 0;
- do
- {
- isSorted = 1;
- for(cmpt=0; cmpt<size-1; cmpt++)
- {
- int cmptBis = cmpt+1;
- if (iArray[cmpt] > iArray[cmptBis])
- {
- swap (iArray, cmpt, cmptBis);
- isSorted = 0;
- }
- }
- } while (isSorted == 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment