You are in charge of protecting a set of defenseless homeowners from predators that roam the area by constructing a fence of minimum length that encloses all of the homes.
The prototype for your solution is as follows:
typedef struct Node {
UInt32 nodeNum,
SInt32 xCoord;
SInt32 yCoord;
} Node;
void Perimeter(
UInt32 numHomes,
Node homesToEnclose[],
UInt32 *numNodesInPerimeter,
UInt32 nodesInPerimeter[]
);
You are given a list homesToEnclose of numHomes homes to protect by constructing a fence around the homes. You should return a list nodesInPerimeter of the numNodesInPerimeter homes to be connected by a fence. The fence must enclose all of the homes using the minimum amount of fencing material.
*)
unit Solution;
interface
// Do not modify the interface
uses
Types, Files;
type Node = record
xCoord: SInt32;
yCoord: SInt32;
end;
type NodeArray = array [0..0] of Node;
type UInt32Array = array [0..0] of UInt32;
procedure Perimeter( numHomes: UInt32; const homesToEnclose: NodeArray; var numNodesInPerimeter : UInt32; var nodesInPerimeter: UInt32Array);
implementation
// Fill in your solution and then submit this folder