In Bubble Sort, array is traversed from 0 to the length-1 index of the array and compared first two values and put the larger one at higher index. Then take next two values compare these values and place larger value at higher index. This process do iteratively until the largest value is not reached at last index. Then start again from zero index up to n-1 index. The algorithm follows the same steps iteratively unlit elements are not sorted.
For ex,if we have an array unsorted A,A,A................ A[n-1] and A[n] as input. Then the following steps are followed by bubble sort algorithm to sort the values of an array.
1.Compare A and A .
2.If A>A then Swap A and A.
3.Take next A and A.
4.Comapre these values.
5.If A>A then swap A and A
at last compare A[n-1] and A[n]. If A[n-1]>A[n] then swap A[n-1] and A[n]. As we see the highest value is reached at nth position. At next iteration leave nth value. Then apply the same steps repeatedly on A,A,A................ A[n-1] elements repeatedly until the values of array is sorted.
While In quick sort algorithm pick an element from array of elements. This element is called the pivot. Then compare the values from left to right until a greater element is find then swap the values. Again start comparison from right with pivot. When lesser element is find then swap the values. Follow the same steps until all elements which are less than the pivot come before the pivot and all elements greater than the pivot come after it. After this partitioning, the pivot is in its last position. Recursively sort the sub-array of lesser elements and the sub-array of greater elements.
For more information,visit the following links:http://roseindia.net/java/beginners/arrayexamples/QuickSort.shtmlhttp://roseindia.net/java/beginners/arrayexamples/bubbleSort.shtml