العربية  

books arrange the bubbles in different languages

If you do not find what you're looking for, you can use more accurate words.

View more

ترتيب الفقاعات بلغات مختلفة (Info)


كود ترتيب الفقاعات بلغة C

typedef int tab_entiers[MAX]; void bubble_sort(tab_entiers t) { int i، j، tmp; for(i = 1 ; i < MAX ; i++) for(j = 0 ; j < MAX - i ; j++) if(t[j] > t[j+1]) { tmp = t[j+1]; t[j+1] = t[j]; t[j] = tmp; } }

كود ترتيب الفقاعات بلغة Java

[MAX]; public class Bubble_sort { /** * @param args */ public static void main(String[] args) { int name[]= {20,10,-5,6,2,1}; int a = 0 ; for (int x = 0; x < name.length; x++) System.out.print(name[x]+" "); System.out.println(); for (int x = name.length - 1 ; x > 0; x--) { for (int y = 0; y < name.length-1; y++) { int temp = name[y]; int temp2 = name[y+1]; if(name[y] > name[y+1]) { name[y] = temp2; name[y+1]= temp ; a++ ; for (int m = 0; m < name.length; m++) System.out.print(name[m]+" "); System.out.println(); } } System.out.println(); } for (int v = 0; v < name.length; v++) System.out.print(name[v]+" "); System.out.println(); System.out.println("the num of changes of the array is "+a); } } } }

Source: wikipedia.org