- 12

- 0

**1. The problem statement, all variables and given/known data**

Compute the time complexity of the following sorting algorithm on an array L[0..n-1] in terms of n. Basic Operation only includes comparison and swap.

sort (L, n)

{

int i=0, j;

while(i<n-1){

s = i ;

j=i+1;

while(j<n){

if (L[j]<L

j++;

}

swap (L

*,L*~~);~~

i++;

}

}

N/A

Well, we have just studied about the big O notation last week, but I have no idea how we apply it to solve this kind of problem.

i++;

}

}

**2. Relevant equations**

N/A

**3. The attempt at a solution**

Well, we have just studied about the big O notation last week, but I have no idea how we apply it to solve this kind of problem.