Question: Need to implement to pseudocode into the program provided. Any help would be appreciated Longest Balanced Span In the longest balanced span problem, we search
Longest Balanced Span In the longest balanced span problem, we search for a large sub-vector whose elements sum to zero ongest balanced span problen inputi a vector Vof n integers output: The span of indices s,e E [O,n) with s::const iterator begin, end_; public: // Create a span from two iterators. Both iterators must refer to the same // vector. begin must come before end span (std::vectorkint>::const_iterator begin, std: :vector<:const iterator end : begin_ end_ t assert equality tests two spans are equal when each of their iterators bool operator span rhs const f return accessors std: :vector>::const iterator& begin) const return begin_; const std::vectorkint>::const_iterator& end) const f return end /I Compute the number of elements in the span. size t size const return end - begin d: Std : :optional& values) { /I TODO: Rewrite the body of this function so that it actually works. That // includes rewriting the return statement. After you do that, delete this // comment return std: :optional O; #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
