Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 The Badgervengers (10 points) Varmel Studios is working on a new superhero movie called The Badgervengers. There will be ss superheroes starring in the

image text in transcribed
3 The Badgervengers (10 points) Varmel Studios is working on a new superhero movie called "The Badgervengers". There will be ss superheroes starring in the movie. Each superhero iS;{1,,s} has a known positive integer combat strength pi. Let m=i=1api be the total combat strength of all of the superheroes. In this film, the superheroes will turn against each other, so the movie producers would like to split them into two tenms of equal size and strength if possible. A team's size is the number of superheroes on the team, and its strength is the sum total of their combat strengths. You can assume that s and m are even. Given the combat strengths of all s superheroes, is it posable to divide S into two teams of equal size and strength, where every superhero appears in exactly one of the teams? 3.1. (3 points) Give a recursive algorithm called SupEnSpLIT that will solve the problem described above. Your recursive algorithm should have 3 parameters: - i - Considering only the first i superheros from S, - jA group size of exactly j. - kA total combat strength of k. SuPERSpLIT will return true, if, out of the first i superheros from S,, there is a group of j superheros with a total combat strength of k

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

More Books

Students also viewed these Databases questions