# CSC 225 ASSIGNMENT 1 solution

\$24.99

Original Work ?

## Description

5/5 - (1 vote)

1 Programming Assignment
The assignment is to design and implement an algorithm for the PairUp225 problem. The problem is deﬁned as follows: Input: An array A of n non-negative integers. Output: A boolean value (true or false). If A can be split into n/2 pairs (x,y) such that x + y = 225, the output will be true. Otherwise, the output will be false. A Java template has been provided containing an empty function PairUp225, which takes an integer array A as its only argument, and returns a boolean value. Your task is to write the body of the PairUp225 function. You may assume that the input array A will always conform to the speciﬁcation above (containing no negative values). Your code is not required to check for incorrectly formed input data.
You must use the provided Java template as the basis of your submission, and put your implmentation inside the PairUp225 function in the template. You may not change the name, return type or parameters of the PairUp225 function. The main function in the template contains code to help you test your implementation by entering test data or reading it from a ﬁle. You may modify the main function, but only the contents of the PairUp225 function will be marked, since the main function will be deleted before marking begins. Please read through the comments in the template ﬁle before starting.
2 Examples
The table below shows the correct output of the PairUp225 function on various test inputs. In cases where the output is true, the set of pairs is given. Input Array Result Pairs 0, 225, 110, 115 true (0,225),(110,115) 150, 125, 100, 175 false N/A 1, 200, 100, 225 false N/A 76, 50, 175, 149 true (76,149),(50,175) 224, 1, 150, 75, 6 false N/A 1,200, 224, 11, 25, 214 true (1,224),(200,25),(11,214) 110 false N/A 110, 115, 110, 115 true (110,115),(110,115)
1
3 Test Datasets
A set of input ﬁles containing test data are available under the ‘Data’ tab on conneX, sorted by their size and whether or not they can be paired up. You should ensure that your implementation gives the correct answer on these test ﬁles before submitting. It may also be helpful to test your implementation on a variety of other inputs, since the posted data may not cover all possible cases. Depending on the running time of your algorithm, it may not be able to process some of the larger input ﬁles.
4 Evaluation Criteria
The programming assignment will be marked out of 20, based on a combination of automated testing (using large test arrays similar to the ones posted on conneX) and human inspection.