Class FilesDisc1
java.lang.Object
topics.greedy.FilesDisc1
GREEDY ALGORITHM PROBLEM: MAXIMIZE THE NUMBER OF FILES ON A DISK
It has an optimal solution. The idea is:
First the smallest files while the disc has enough
space to copy them
- Author:
- vicegd
-
Constructor Summary
ConstructorsConstructorDescriptionFilesDisc1(int[] files, int discCapacity) Constructor for FilesDisc1 objects -
Method Summary
-
Constructor Details
-
FilesDisc1
public FilesDisc1(int[] files, int discCapacity) Constructor for FilesDisc1 objects- Parameters:
files- Size of the files useddiscCapacity- Maximum disc capacity
-
-
Method Details
-
calculate
public int calculate()Calculates the amount of files in a disc- Returns:
- The number of files inserted in the disc
-