Recursive function

Assignment Help C/C++ Programming
Reference no: EM13165045

What is the result of the following recursive function when called with mm(10)? Write out the execution trace of this call to mm(10). 

long mm(int n) {

}

if ( n < 2 ) return 0;

if ( n % 3 == 0 ) return -1;

if ( n % 3 == 1 ) return 1;

else return 2*mm(n-1) + 3*mm(n-2);

Reference no: EM13165045

Questions Cloud

What is the caloric value of the oil : a .50 g sample of vegetable oil is placed in a calorimeter when the sample is burned 18.9kJ are given off what is the caloric value of the oil.
Postive social value-skills in learning to other effectively : Identify and describe at least two ways you use the classroom curriculum to help students develop postive social values and skills in learning to relate to others effectively.
Find a recurrence relation for the number : Find a recurrence relation for the number of bit strings that contain the string 01 . what are the initial condition , and how many bit strings of length seven contain the string 01. please explain it fully step by step to better undestand
What authoritative literature addresses comprehensive income : What authoritative literature addresses comprehensive income? What is the predecessorstandard for the topic you selected and provide the definition of comprehensive income.
Recursive function : What is the result of the following recursive function when called with mm(10)? Write out the execution trace of this call to mm(10).
The text files boynames.txt : The text files boynames.txt and girlnames.txt contain a list of the 1,000 most popular boy and girl names in the U.S. for the year 2003 as compiled by the Social Security Administration.
Chess program, enable a monitoring component : Given a chess program, enable a monitoring component to switch planning algorithms at runtime, based on the opposing player's style and response time.
Social contract theory : A principal difficulty with social contract theory is that it requires people to follow the social contact rules - to keep their agreements and not to harm others - even when many others in society refuse to abide by the social contract rules.
Bare in mind this is a program : Bare in mind this is a program with the audience being lawncare and landscaping people. So the events will generally be to know how often a client wants their lawn mowed.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c program that reads a data file of floating numbers

Write a program that reads a data file of floating numbers into an array and prints the array elements along with the number of items in the array

  Write a program that reads in a list of integer numbers and

Write a program that reads in a list of integer numbers and print out the sum of all numbers, the average, the lowest and the highest value entered. The first input number indicates how many numbers the program is attempting to read. For example, if ..

  First display the smallest volume and then the largest volum

first display the smallest volume and then the largest volume.

  Write c program which compute acceleration of jet fighter

Write a C++ program which compute the acceleration (m/s 2) of jet fighter launched from aircraft-carrier based catapult, provided jet's takeoff speed in km/hr

  Perform operations on arrays

Perform operations on arrays execute tests and repetitions

  Dynamic character arrays

Dynamic character arrays str and add contain strings. Write a function append that uses str and add as arguments and appends add to the end of str. Write a main program that illustrates the use of function append to concatenate five strings.

  Emulates the behavior of a bus

Write a program that emulates the behavior of a bus. The bus must have a schedule ( a finite number of times for it to stop) and a certain capacity (number of passengers). In this program the bus has two states: stopped and going.

  Write main function to compute stress-strain in steel rod

Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) and length L (inches) subject to the compression loads.

  Program to produce ten random permutations of numbers

In C++(must be able to compile in Visual Studio ): Write a program to produce ten random permutations of numbers 1 to 10.

  Program to compute diameter in centimeters of a steel rod

Write a program to compute the diameter in centimeters of a steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.

  Definitions of the class circularlinkedlist

Write the definitions of the class circularLinkedList and its member functions. (You may assume that the elements of the circular linked list are in ascending order.)

  Design a nested program

How many levels of nesting are there in this design?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd