Answered step by step
Verified Expert Solution
Question
1 Approved Answer
WRITE IN C++ Your function will track the index into the subvector whose contents sum to the largest (most positive) integer value and record what
WRITE IN C++
Your function will track the index into the subvector whose contents sum to the largest (most positive) integer value and record what that sum was. Keep in mind that the subvector may have positive and negative values. Since the two-dimensional vector is non-rectangular, you cannot assume that the subvectors contain an equal number of elements: the number of elements stored in one subvector can (and will) differ. If more than one subvector sums to the same value and that value is the largest sum, record the subvector with the smaller index. What does a smaller index mean? Given a two-dimensional vector indexed as vect. at (subvector_idx). at(subvector_ele_idx), we mean the subvector residing at the smaller value of subvector_idx. Once you're finished examining the twodimensional vector, create a new LargestsumPair object, initializing the data member index with the index to the subvector whose contents sum to the largest (most positive) integer value and sum with the sum calculated for that subvector. Assume the two-dimensional vector passed to your function will have at least one subvectorStep 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