Procedure BubbleSort2(var v:vetor;tam:integer); Var i, n, troca, aux : integer; Begin n := tam; repeat troca:=0; For i:=1 to n-1 do begin If v[i]>v[i+1] then begin aux:=v[i]; v[i] := v[i+1]; v[i+1] := aux; troca:=i; end; end; n := troca; until troca=0; End;