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

Make a function in java script and compare with ten, Write JavaScript code ...

Write JavaScript code for the following: Make a function compare With Ten (value) Compare the function argument along with ‘10' and display a message while the value is le

Ajax- html- xml- css and tomcat used in java, AJAX- HTML- XML- CSS and  To...

AJAX- HTML- XML- CSS and  Tomcat used in Java: Project Title: Zee Ads   Role                       : Developer Domain                  : Web Ads Environment

Explain the library java.lang.math, Explain the library java.lang.Math ? ...

Explain the library java.lang.Math ? The Java class library is huge. We will not cover it all presently. In fact, the remaining eight classes will focus mostly on the class lib

Activity diagram, The statechart diagrams and activity diagram are related ...

The statechart diagrams and activity diagram are related in a sense that statechart diagram refers on object undergoing a transition process and an activity diagram refers on the f

Flash games, have some assignments and i want help with them. thanks

have some assignments and i want help with them. thanks

Develop a adobe air native extension, Develop a Adobe Air Native Extension ...

Develop a Adobe Air Native Extension Project Description: We are seeking someone that must create an adobe native extension for the subsequent SDK: Develop a Adobe Air Nat

OOP, differentiate between states and behaviors of n object

differentiate between states and behaviors of n object

Questions pseudocodes, 1. Write the pseudocode to get the input of 10 integ...

1. Write the pseudocode to get the input of 10 integers from the user and add them up and output the total. (4 points) 2. Compute the output of following pseudocode. Assume that

Illustrate the parser method, Illustrate the parser method The below ta...

Illustrate the parser method The below table summarizes the parser methods available to a java programmer.

Explain the different kinds of exceptions, Explain The different kinds of e...

Explain The different kinds of exceptions ? Checked Exceptions  : Environmental error in which cannot necessarily be detected through testing; e.g. broken socket, disk full,

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