### Free Educational Resources

• > CMSC 350 HOMEWORK 3 1. (15 POINTS) WRITE A STATIC RECURSIVE
+

# CMSC 350 HOMEWORK 3 1. (15 POINTS) WRITE A STATIC RECURSIVE

##### Rating:
(0)
Author: Joyce Buda
##### Description:

http://theperfecthomework.com/cmsc-350-homework-3-1-15-points-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/

CMSC 350 Homework 31. (15 points) 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. (15 points) Write a static recursive Java method that will accept two int's (A and B) and willwrite the representation of A base B, one character per call, to System.out. Assume that B isless than 36, and use digits 0 through 9, followed by characters A through Z to represent thecharacters of B.For example, 15 base 10 would be printed as F base 16.3. (10 points) For the following tree, what is the order if the root is taken to be node A and the treeis traverseda) in pre-orderb) in post-orderc) in level-order4. (10 points) For the tree in part 1, same questions but take the root as node L.5. (10 points) In a 5-ary tree, that is a tree with at most 5 children at each node, how many nodescan a tree of height H have. Recall that the height of a tree is a length of the longest path fromthe root to the leaf nodes of the tree.6. (10 points) In a 5-ary tree, what is the maximum height of a tree with N nodes. Since that waseasy, let's try one a little harder: what is the minimum height of a tree with N nodes?7. (30 points) Write a recursive method listLinks that will list all the links in a tree or subtree of anode.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 foreach call of the listLinks method should be to System.out, with the first token the representationof 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 linksin 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 ()

(more)
##### Try a College Course Free

Sophia’s self-paced online courses are a great way to save time and money as you earn credits eligible for transfer to over 2,000 colleges and universities.*

No credit card required

26 Sophia partners guarantee credit transfer.

226 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 21 of Sophia’s online courses. More than 2,000 colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.

Tutorial