Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please don't just copy the answer before,something has been changed. Q 1 ) This question is concerned with the design and analysis of recursive algorithms.

please don't just copy the answer before,something has been changed. Q1) This question is concerned with the design and analysis of recursive algorithms. You are given a problem statement as shown below. This problem is concerned with performing calculations on a sequence A of real numbers. Whilst this could be done using a conventional loop-based approach, your answer must be developed using a recursive algorithm. No marks will be given if your answer uses loops. FindSumPosAndNeg(a1,..., an) Input: A sequence of real values A =(a,..., an), such that no values of A are 0. Output: A 2-tuple (sum1, sum2) containing the sum (sumi) of all the positive values and the sum (sum2) of the negative value of the elements in A. Your recursive algorithm should use a single recursive structure to find the sum values and should not use two separate instances of a recursive design.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions