• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help with Bubblesort

pecel

Golden Member
procedure bubblesort;
var i, t, integer;
begin
repeat until t = a[1]
t:=a[1];
for j:=2 to n do
if a[j-1] > a[j] then begin
t:= a[j-1];
a[j-1]:=a[j];
a[j]:=t;
end
end rep
end

Partition the design into sub functions, and define a set of conditions that would enable you to prove that this algorithm is correct.

Thanks.
 
Back
Top