Challenge+2

=**Question** = =**Using array;** = =**char Allocations[5] ** = =//Base on the following explanations, algorithm given and your own research. Make use of Bubble Sort to sort Allocations array into alphabetical order.// =
 * {z,v,E,a,b}**=

Helps

 * What is Bubble sort?**
 * Bubble sort** is a simple sorting algorithm . It works by repeatedly stepping through the list to be sorted, comparing two items at a time and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.

code do swapped := false for each i in 0 to length(A) - 2 if A[ i ] > A[ i + 1 ] then swap( A[ i ], A[ i + 1 ] ) swapped := true end if   end for while swapped is true code
 * Algorithm**

Here is a step by step guide to apply Bubble sort to an array of integers containing {4,2,6,0} First of all, we are interested to sort the array of integers into Ascending (small to big) order.
 * Step Thru**

1st pass 2nd Pass 3rd Pass  Array of 4 elements sorted in ascending order using Bubble sort.
 * We started with {**4,2**,6,0} ---> {**2,4**,6,0} Here the algorithm compares the first two numbers and place them into the correct order
 * Repeat the process for the next two numbers
 * Start {2, **4, 6**, 0} --> {2, **4, 6**, 0} the algorithm compares the 2nd and the 3rd elements in the array an place them in correct order
 * Start {2, 4, **6, 0**} --> {2, 4, **0, 6**} the algorithm compares the 3rd and the 4th elements in the array an place them in correct order
 * After 1 pass, the biggest number, 6, in the array is in the correct position. Repeat the same process from the first element again til '0'
 * <span style="color: rgb(255, 0, 0);">Start {2,4,0,6} --> {2,4,0,6}
 * <span style="color: rgb(255, 0, 0);">Start {2,4,0,6} --> {2,0,4,6}
 * <span style="color: rgb(255, 0, 0);">After 2nd pass 4, 6 are in order. Repeat the same process for the first 2 numbers
 * <span style="color: rgb(255, 0, 0);">Start{2,0,4,6} --> {0,2,4,6}
 * <span style="color: rgb(255, 0, 0);">After 3 passes all elements are in order.

=
Bubble sort is one of the simplest sorting algorithms to understand and implement, its //[|O(n2)]// complexity means it is far too inefficient for use on lists having more than a few elements.======