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

Develop a custom android app, Develop a Custom Android App Project Descr...

Develop a Custom Android App Project Description: We want you to construct a custom Android app. Once user downloads the app and upon installation the user gets push notif

Universal android and ios, Universal Android and iOS, Multipurpose Testing ...

Universal Android and iOS, Multipurpose Testing Application - Based on Phonegap Project Description: Universal Android and iOS, Multipurpose Testing Application Based on Phon

Object oriented programming language, what are the steps of object oriented...

what are the steps of object oriented programming language?

What are the core classes of the struts framework, Struts is a set of coope...

Struts is a set of cooperating classes, servlets, and JSP tags that make up a reusable MVC 2 design. ? JavaBeans components for managing application state and behavior. ? Eve

Developing a prototype system in php and javascript, General Overview A...

General Overview A number of organisations are using micro-blogging as a cost-effective way of communicating with customers, building online communities and releasing informati

Create an executable application in java, This assignment requires you to d...

This assignment requires you to design, implement and test a program using Java features from the first half of the subject content. You are required to implement in Java all the c

What is an xml namespace?, Question 1 What is Response Redirection? Explai...

Question 1 What is Response Redirection? Explain in brief Question 2 What is JDBC? Explain Question 3 Write a short note on Expressions Question 4 What is an XML na

Develop student furniture finder, Project Description: We are looking to...

Project Description: We are looking to prepare an app which allows the user (a student or an expat in a new country) to select from a list of furniture items to prepare a packag

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