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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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