Question: Write a function which returns the sum of the 2 largest integers in an array. You are not allowed to sort the array. int SumTwoLargest(int
Write a function which returns the sum of the 2 largest integers in an array. You are not allowed to sort the array.
int SumTwoLargest(int *data, int lengthOfData) // if using C++
Check your results with the following data sets
10, 5, 10 should return 20 10, 5, 15 should return 25 5, 10, 20 should return 30 5, 10, 10 should return 20 -5, -10, -1 should return -6 15, 10, 0 should return 25 10, 5, 7 should return 17 10 should throw insufficient data exception
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
