Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started