Sorting algorithms/Merge sort: Difference between revisions

Content added Content deleted
(Add SETL)
m (→‎{{header|Component Pascal}}: change "StdLog" to "Out")
Line 2,976: Line 2,976:


(* Import Modules: *)
(* Import Modules: *)
IMPORT Sort := RosettaMergeSort, Log := StdLog;

IMPORT Sort := RosettaMergeSort, Out;


(* Type Definitions: *)
(* Type Definitions: *)
Line 3,027: Line 3,029:
WHILE s # NIL DO
WHILE s # NIL DO
IF count = 10 THEN
IF count = 10 THEN
Log.Ln; (* Insert a newline after displaying 10 numbers *)
Out.Ln; (* Insert a newline after displaying 10 numbers *)
count := 0
count := 0
END;
END;
Log.IntForm(s.value, Log.decimal, 4, ' ', Log.hideBase);
Out.Int(s.value, 4);
s := s.next;
s := s.next;
INC(count)
INC(count)
Line 3,050: Line 3,052:
b(590); b(255); b(101); b(485); b(801); b(223); b(645); b(458);
b(590); b(255); b(101); b(485); b(801); b(223); b(645); b(458);
b(068); b(683);
b(068); b(683);
Log.String("Before:"); Log.Ln;
Out.String("Before:"); Out.Ln;
Show(s); Log.Ln;
Show(s); Out.Ln;
s := t.Sort(s)(List);
s := t.Sort(s)(List);
Log.String("After:"); Log.Ln;
Out.String("After:"); Out.Ln;
Show(s); Log.Ln
Show(s); Out.Ln
END Use;
END Use;


END RosettaMergeSortUse.
END RosettaMergeSortUse.Use
</syntaxhighlight>
</syntaxhighlight>
Execute: ^Q RosettaMergeSortUse.Use
Execute: ^Q RosettaMergeSortUse.Use