Write a static recursive java method

Assignment Help JAVA Programming
Reference no: EM131104750

1. Write a static recursive Java method that will accept an int and write the base 2 (binary) representation of that int, one bit per recursive call, to System.out.

2. Write a static recursive Java method that will accept two int's (A and B) and will write the representation of A base B, one character per call, to System.out. Assume that B is less than 36, and use digits 0 through 9, followed by characters A through Z to represent the characters of B. For example, 15 base 10 would be printed as F base 16.

3. For the following tree, what is the order if the root is taken to be node A and the tree is traversed?

a) in pre-order

b) in post-order

c) in level-order

1983_Figure.png

4. For the tree in part 1, same questions but take the root as node L.

5. In a 5-ary tree, that is a tree with at most 5 children at each node, how many nodes can a tree of height H have. Recall that the height of a tree is a length of the longest path from the root to the leaf nodes of the tree.

6. In a 5-ary tree, what is the maximum height of a tree with N nodes. Since that was easy, let's try one a little harder: what is the minimum height of a tree with N nodes?

7. Write a recursive method listLinks that will list all the links in a tree or subtree of a node.

The context should be a Node (a class with a getChildren method that will return a List <Node> of the child nodes of that node) and use the toString method of the Node class. The output for each call of the listLinks method should be to System.out, with the first token the representation of the node followed by a space-separated list of the children of the node. Calling this method in the context of the root node of a tree will result in a listing of all the links in the tree. The call would be something like:

tree.root.listLinks ();

The signature of this method should be:

void listLinks ()

And you will use a method with the following signature:

List <Node> getChildren ()

Reference no: EM131104750

Questions Cloud

Find and discuss an interesting example of recursion : Find and discuss an interesting example of recursion - thus, an example other than those presented in the readings. Your discussion should: give citations
Difference between an estate tax deduction : Explain the difference between an estate tax deduction and an estate tax credit - The estate tax deduction is the difference between the estate taxincluding IRD items and the estate tax without IRD items.
What is the required passband of the doppler filter : What is the required passband of the Doppler filter?
What effect will this investment have on edmund enterprises : What effect will this investment have on Edmund Enterprises earnings per share this year? What effect might this investment have on the companys intrinsic value and stock price?
Write a static recursive java method : Write a static recursive Java method that will accept an int and write the base 2 (binary) representation of that int, one bit per recursive call, to System.out
How should ace allocate proceeds received among components : Should the various components of each MEDS be accounted for separately? If so, how should Ace allocate the proceeds received among the components?
Prepare an appropriate bankruptcy petition : Prepare an appropriate bankruptcy petition for Tim, along with all of the appropriate schedules.
Is tiaa-cref an ordinary shareholder : Is TIAA-CREF an ordinary shareholder? Explain.Due to its asset size, TIAA-CREF owns many shares in a number of companies.
Promote a more optimal use of contraceptives : Health officials have suggested that teen pregnancy and sexually transmitted diseases can be reduced if contraceptives are more widely used. Use the concept of a demand-side externality to explain why the amount of contraceptives in the United States..

Reviews

Write a Review

JAVA Programming Questions & Answers

  What are the main differences between javabeans and applets

What are the main differences between JavaBeans and applets? How do I use an applet that resides on a remote machine?

  What is the output of the following program explain

What is the output of the following program? Explain. Explain the meaning of the reserved word this and why it is necessary in the class below. Will the class compile without using this

  What are the concerns about how java implements arrays

What are the concerns about how Java implements arrays? What are your concerns? In Java, what is the starting index of an array

  Develop a java based gui application

Develop a Java based GUI application(using swing) that allows the user to enter Charity/Fund information and display them in a JTable

  You need to prepare a java program using class

You need to prepare a java program using class and method to calculate commission of sales person with fix salary of $75,000 and 25% sales commission. Program should prompt for amount of total sales

  How are the packaged files viewed

How are several Java files packaged, Why is there a need for packaging java files and How are the packaged files viewed?

  Create a java program that performs distributed systems task

Can someone create a Java program that performs the following distributed systems tasks? This should be easy for a Java programmer

  Special car rental code from the license plate

When you rent a car from an agency, the key ring has several pieces of information: license plate, make and year of car, and usually a special code. This code could be used for some data processing within the company's computers. This lab will practi..

  Use server-side validation to validate all user entries

Use server-side validation to validate all user entries

  Write a java program that uses the elapsed time

Write a Java program that uses the elapsed time for an event in second and then outputs the elapsed time in hours, minutes and seconds. (For example, if the desired time is 9630 seconds, then the output is 2: 40: 30)

  Why the java is called platform independent

Why the Java is called platform independent? Discuss.

  Ask the user how many times you want to run

c the algorithm. 2. Then choose a word at random from the array of Strings as the target (Use the integer random number generator)

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