Friday 24 June 2011

Simple visual version of Bubble Sort


Simple visual version of Bubble Sort, adapted from previous code
<----void draw() {


// If the mouse is pressed sort the array
if (mousePressed == true) {
bubbleSort(myArray);
for(int i=0;i fill(myArray[i]*20, myArray[i]*25, myArray[i]*5, myArray[i]*20);
ellipse(50, +i*25, myArray[i]*2, myArray[i]*2);
print(" " + myArray[i]);
}
}
}
------>

No comments:

Post a Comment