{+--------------------------------------------------------------------------+}
{| The Textbook in Data Structure, Algorithms and Programming |}
{| http://w...content-available-to-author-only...c.jp/~hoangle/DSAPTextbook/ |}
{| |}
{| Program: Finding_the_Minimum_Spanning_Tree_using_Kruskal_Algorithm |}
{| Written by Le Minh Hoang |}
{| Email: dsaptextbook@gmail.com |}
{+--------------------------------------------------------------------------+}
{$MODE DELPHI} (*This program uses 32-bit Integer [-2^31 .. 2^31 - 1]*)
program Finding_the_Minimum_Spanning_Tree_using_Kruskal_Algorithm;
(*
IMPORTANT NOTES FOR COMPATIBILITY:
==================================
- This program is especially written for running under Windows 32 bit and
Free Pascal IDE. Therefore, 32-bit Integer type is used to result in the
best performance with the {$MODE DELPHI} compiler directive of FPK for
Windows.
- If you use Borland Turbo Pascal 7 for DOS, you may have to reduce the
data structure to deal with the limited memory. In addition, BP7 does not
support 32-bit Integer type, it causes some Integer variables would have
to be converted into LongInt variables.
- If you prefer to compile under Delphi, you can simply convert the source
code as follows:
+ Replace the type "Text" with the type "TextFile"
+ Change all procedure calls "Assign(., .)" to "AssignFile(., .)" and
"Close(.)" to "CloseFile(.)"
+ Remove the {$MODE DELPHI} and add the {$APPTYPE CONSOLE} compiler
directive to the beginning of this program
-----------------------------------------------------------------
Please report any errors to: dsaptextbook@gmail.com, MANY THANKS!
-----------------------------------------------------------------
*)
const
InputFile = '';
OutputFile = '';
maxV = 1000;
maxE = (maxV - 1) * maxV div 2;
type
TEdge = record
u, v, c: Integer;
Mark: Boolean;
end;
var
e: array[1..maxE] of TEdge;
Lab: array[1..maxV] of Integer;
n, m: Integer;
Connected: Boolean;
procedure PrintResult;
var
i: Integer;
begin
for i:=35 downto 0 do WriteLn(i);
end;
begin
PrintResult;
end.