Purchase Solution

problem using recursion

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

Solution Summary

A problem using recursion is shown.

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;
...

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Basic Networking Questions

This quiz consists of some basic networking questions.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.