Write My Essay
Gifting problem | data structures and algorithms
Suppose you are in charge of a non-profit organization that receives donated gifts and distributes them to
needy children. You are given a list of children with their ages (0 to 16 years old).
For each gift, you are given the following information:
Size of gift (cubic feet)
Range of suitable ages
Let: P = sum of retail prices of the gifts
N = total number of children
ei = | P/N – sum of retail prices for gifts given to child i |
You must minimize Σ ei for the N children, subject to the following constraints:
The sum of the e_i values MUST be the absolute lowest value that is possible for the given input file.
Command line: ./gifting inputFileName outputFileName
Compiles, good programming style, processes command line arguments 15 pts.
Produces correctly formatted output file with all children and gifts included 10 pts.
Produces optimal solution 70 pts.
Compute time/space efficiency, creativity 5 pts. + extra credit possible
Plain text tab-delimited file. See example on next page. Child1 age 8
Child2 age 6
Child3 age 4
Gifts Price Size Ages
G1 12 1.3 7-14
G2 15 2.5 any
G3 8 1.5 0-5
G4 22 2.8 6-16
G5 10 1.5 any
G6 11 2.1 any
The output should be a plain text tab-delimited file. It must begin with ‘Sum_e_i x’, where x is the sum of the ei
values. This should be followed by N rows, one for each child (in order), with their assigned gifts and ei value
Child1 G1 G6 3
Child2 G5 G4 6
Child3 G3 G2 3
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more