Objectives
- Implement a simple sort algorithm.
- Discuss algorithm run time (order).
// Assume that the data is in an array for each element p from the first to the next to last for each element q from just after p to the last if p and q are out of order, then swap them
void sort(int ar[], int len) { int temp, i, j; for (i=0; i<len-1; i++) { for (j=i+1; j<len; j++) { if (ar[j] < ar[i]) { temp = ar[j]; ar[j] = ar[i]; ar[i] = temp; } } } }