answersLogoWhite

0

I hope these example will help you:

static int Direct (int n)

{

if (n<=0) return 0;

else return n + Direct (n-1);

}

static int InDirect (int n)

{

if (n<=0) return 0;

else return n + Buddy (n-1);

}

int Buddy (int n)

{

return InDirect (n);

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

Difference between direct and indirect address instruction?

the different between direct and indirect adress instruction


Types of recursion?

Direct: int foo () { ... foo (); ... } Indirect: int foo () { ... bar (); ... } int bar () { ... foo (); ... }


What is the difference between the direct and indirect base class?

Direct base classes are those that are specified in a derived class' inheritance declaration. Indirect base classes are those that are inherited via the direct base classes. class A{}; class B : public A{}; class C : public B{}; With respect to C, B is direct while A is indirect. With respect to B, A is direct.


What is difference between direct addressing and indirect addressing in c plus plus?

Indirect addressing uses a pointer. Indirectly accessing the memory being pointed at is known as dereferencing. Direct addressing uses a variable's name or a reference to obtain the value.


What is the difference between direct and indirect methods of flood control?

Direct methods of flood control involve proactive measures to manage water flow, such as constructing levees, dams, and floodwalls to contain or redirect floodwaters. Indirect methods focus on land-use planning, such as zoning regulations, vegetation management, and wetland restoration, to reduce flood risks and enhance natural absorption. While direct methods provide immediate protection, indirect methods aim to mitigate future flooding impacts through sustainable practices. Both approaches can be used in combination for effective flood management.

Related Questions

What is direct recursion?

When a function calls itself it is called as direct recursion. A function calls other functions which eventually call the original function is called as indirect recursion.


Differentiate between direct marketing and indirect marketing?

The difference between direct marketing and indirect marketing.


Difference between direct and indirect address instruction?

the different between direct and indirect adress instruction


What is the difference between indirect and direct quote life insurance?

The difference between indirect and direct quote life insurance is that the insurance level will differ. Direct is when someone dies, indirect involves other factors.


What is the difference between direct and indirect supervisor?

The difference between direct and indirect supervisor is the presence of the supervisor. Direct supervision means a supervisor is psychically present. Indirect supervision means doing work without the physical presence of the supervisor.


What is the difference between direct and indirect correlation in statistics?

GJVG


What is the difference between direct tax and non-direct tax?

difference b/w direct tax and indirect tax


What is the difference between a direct and indirect hernia?

if hernia tissu pass thrw ing.ring that is indirect ing.hernia.if it is pass thrw abdominal wall that is direct ing.herniaif hernia tissu pass thrw ing.ring that is indirect ing.hernia.if it is pass thrw abdominal wall that is direct ing.herniathe difference between direct hernia and indirect hernia is the direct hernia only affected the superficial inguinal ring and the indirect is affected the deep inguinal ringthe difference between direct hernia and indirect hernia is the direct hernia only affected the superficial inguinal ring and the indirect is affected the deep inguinal ring


What is the difference between direct expense and indirect expense in financial account?

give the full chart of the direct and indirect expenses . detail about this


The difference between direct taxs and indirect taxs and give examples of each?

The difference between direct taxes and indirect taxes with examples is that direct taxes come directly from a person's income or personal property taxes. Indirect taxes comes from sales and excise taxes.


Difference between direct cost and indirect cost?

direct cost has direct relation with product manufacturing while indirect cost not and not identifiable with cost as well.


What is the difference between direct democracy and indirect democracy?

direct democracy is when each person rules and indirect is when people vote for people who rule.