So I have this code:
done <- false [1]
n <- 0 [1]
while (n < a) and (done = false) [(n+1)(1+1+1)]
done <- true [n]
for m <- (a- 1) downto n [n(1+1+1+1)]
if list[m] < list[m - 1] then [n]
tmp <- list[m] [n]
list[m] <- list[m-1] [n]
list[m - 1] <- tmp [n]
done <- false [n]
n <- n + 1 [1]
return list [1]
Am I doing this right? My conclusions are that the inne for-loop runs (n^2 + n) / 2 times and the outher while-loop runs n+1 times. I don't know how to properly argue for that the bubble sort has the complexity O(n^2)