Please put your work in directory cs201 on your Linux account before 11:59pm of the day above.
Name the project Hw5_1
Solution
that takes an array of integers, removes duplicates from this array, and returns the resulting array with no duplicates. For example, if this method gets the following array
then the returned array should be
The output of the program must be the original array (with duplicates) and the resulting one (with duplicates removed).
Your method must work not only with the array above, but with ANY array of length at most 50. The program should load the array from the command-line parameters.
Name the project Hw5_2
Solution
they have to be arranged in a 2-dim array as follows:
2 45 16 22 17 21 67 29 45 67 97 35 68 34 90 72 |
Your program has to check if the number of input numbers is a square of an integer and report an error and terminate if this is not the case. You can assume that at most 100 numbers will be entered.
If the input numbers can be arranged in an nxn table, the program has to iprint out the resulting table and compute the sum of numbers on each of the diagonals and print them out. For the above example the following sums have to be computed:
Your program should work for any set of numbers, not just for the one above.
Name the project Hw5_3
Solution
that merges two arrays, alternating elements from both arrays. If one array is shorter than the other one, then alternate as long as you can and then append the remaining elements from the longer array in their order. For example, if
then merge returns the array
Initialize both arrays in your code (at least 5 elements in each array). You
should not assume that the second array is always longer.
Your program should display the original arrays and the merged array on the
screen.
Name the project Hw5_4
Solution