Write a recursive function, JAVA Programming

Assignment Help:

1) Write a function that uses recursion that converts a decimal number to octal (base 8). The function should accept a single integer and return a String containing the base 8 equivalent.

2) Write a recursive function that implement the following functions:

a. x0 = 1
xn = x * xn-1 if n > 0

b. x0 = 1
xn = (xn/2)2 if n > 0 and n is even
xn = x * (xn/2)2 if n> 0 and n is odd

3) How many multiplications will the functions you wrote in problem #2 perform when computing 319? 332?
How many recursive calls will the functions make when computing 319? 332?

4) Write a recursive function that implements the following function:

f(1) = 1; f(2) = 1; f(3) = 1; f(4) = 3; f(5) = 5
f(n) = f(n-1) + 3 * f(n-5) for all n > 5

Make the function as efficient as possible.

5) Compute f(n) for n = 6, 7, 12, 15


Related Discussions:- Write a recursive function

Jumps in loops, explain jumps in loops and explain labelled loops

explain jumps in loops and explain labelled loops

Data types in javascript, A value, the data assigned to a variable, may con...

A value, the data assigned to a variable, may contain any sort of data. Though, JavaScript considers data to fall into many possible types. Based on the type of data, certain opera

Area under curve , what will be the logic? in C program #include ...

what will be the logic? in C program #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area; int numtraps; m

Describe java operators, Describe java operators? An operator is a symb...

Describe java operators? An operator is a symbol which operates on one or more arguments to generate a result. The Hello World program is so easy it doesn't use any operators,

Vehicle loan application - weblogic administrator, Vehicle Loan Application...

Vehicle Loan Application: Type                                         Web-based Application Role                                          Weblogic administrator + develop

About state and behavier of two different object, two different object may...

two different object may have chance to have same behavier but property must be different why?

Basic difference between java and c++, Both Java and C++ use same syntax an...

Both Java and C++ use same syntax and are Object Oriented, but there are several differences between Java and C++:   1.    Java does not use pointers. Pointers are inherently

What is multiple inheritance, What is Multiple Inheritance ? A few obje...

What is Multiple Inheritance ? A few object oriented languages, notably C++, permits a class to inherit from more than one unrelated class. This is known as multiple inheritanc

I need java expert with tomcat tuning experience, I need Java expert with t...

I need Java expert with tomcat tuning experience Project Description: Require a Java expert to fix memory issues with tomcat. Skills required: Java, Apache

Write Your Message!

Captcha
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