First-fit decreasing algorithm question
Question
How many external hard drives, each of which can hold \(800GB\), are needed to store these computer files.
File | A | B | C | D | E | F | G | H | I | J | K |
Size (\(GB\)) | \(200\) | \(600\) | \(700\) | \(400\) | \(300\) | \(200\) | \(500\) | \(100\) | \(400\) | \(100\) | \(300\) |
File |
---|
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
K |
Size (\(GB\)) |
---|
\(200\) |
\(600\) |
\(700\) |
\(400\) |
\(300\) |
\(200\) |
\(500\) |
\(100\) |
\(400\) |
\(100\) |
\(300\) |
First sort the files into order.
File | C | B | G | D | I | E | K | A | F | H | J |
Size (\(GB\)) | \(700\) | \(600\) | \(500\) | \(400\) | \(400\) | \(300\) | \(300\) | \(200\) | \(200\) | \(100\) | \(100\) |
File |
---|
C |
B |
G |
D |
I |
E |
K |
A |
F |
H |
J |
Size (\(GB\)) |
---|
\(700\) |
\(600\) |
\(500\) |
\(400\) |
\(400\) |
\(300\) |
\(300\) |
\(200\) |
\(200\) |
\(100\) |
\(100\) |
Now continue as you would with the first-fit algorithm by putting each file into the first drive that has room for it.
5 external hard drives are needed to hold these files.