Explore BrainMass
Share

Explore BrainMass

    problem using recursion

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Please provide a little guidance on how to solve the following problem using recursion. I can understand solving it using iteration .. but not recursion.

    Design a game called Jump it.
    It consists of a board of n integers rows. All containing positive integers except the first one always containing 0.

    The object is to move from the first to the last column. With each jump the interger in the column is added to a sum. The goal is to move to the last column having the lowest sum.
    Moves consist of either moving to the adjacent column or skipping 2 cols and jumping to the next one.

    The board consists of an array.

    Examples:
    0 - 3 - 80 - 6 - 57 - 10 ===> 3+6+10=19
    0 - 3 - 5 - 4 - 1 - 10 ====> 5+1+10 =16.

    © BrainMass Inc. brainmass.com October 9, 2019, 5:55 pm ad1c9bdddf
    https://brainmass.com/computer-science/java/problem-recursion-72138

    Solution Preview

    We define the recursion function JUMP (A), where A is the input array, as follows:

    Let A has n element
    int JUMP(A) {
    if (A is empty)
    return 0;
    ...

    Solution Summary

    A problem using recursion is shown.

    $2.19