SlideShare a Scribd company logo
Buy here:
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.
2.(15 points) 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.(10 points) 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
4.(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
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.(10 points) 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.(30 points) 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 ()

More Related Content

PPTX
PPT
Data Structure and Algorithms Binary Tree
PPTX
Binary Tree Traversal
PDF
Tree and binary tree
PPTX
THREADED BINARY TREE AND BINARY SEARCH TREE
PPTX
Threaded Binary Tree
PDF
Tree Data Structure by Daniyal Khan
PPT
Tree-In Data Structure
Data Structure and Algorithms Binary Tree
Binary Tree Traversal
Tree and binary tree
THREADED BINARY TREE AND BINARY SEARCH TREE
Threaded Binary Tree
Tree Data Structure by Daniyal Khan
Tree-In Data Structure

What's hot (20)

PPT
Binary tree
PDF
Binary tree
PDF
Threaded binarytree&heapsort
PPT
Data structures final lecture 1
PPTX
Binary tree traversal ppt
PPTX
Lecture 8 data structures and algorithms
PDF
Binary tree
PDF
Trees, Binary Search Tree, AVL Tree in Data Structures
PPTX
Chap 7 binary threaded tree
PPTX
Trees in Data Structure
PPT
Tree traversal
PPT
DATA STRUCTURES
PPTX
Tree
PPTX
B and B+ tree
PDF
Red Black Trees
PDF
10 Red-Black Trees
PPT
Binary search tree(bst)
PPT
Best for b trees
Binary tree
Binary tree
Threaded binarytree&heapsort
Data structures final lecture 1
Binary tree traversal ppt
Lecture 8 data structures and algorithms
Binary tree
Trees, Binary Search Tree, AVL Tree in Data Structures
Chap 7 binary threaded tree
Trees in Data Structure
Tree traversal
DATA STRUCTURES
Tree
B and B+ tree
Red Black Trees
10 Red-Black Trees
Binary search tree(bst)
Best for b trees
Ad

Viewers also liked (9)

PDF
CMSC 350 HOMEWORK 1
PPTX
Визитка - Селюшкина Е.Н.
PPT
Stylish Window Treatments Ideas
PPTX
Statewide Workforce Planning Update
PPTX
PPTX
Бібліотека як третє місце
PPTX
Bloque 4 imagen y sonido
PPT
Bloque 2 elementos de configuración formal
PPT
Bloque 2 tecnicas de dibujo
CMSC 350 HOMEWORK 1
Визитка - Селюшкина Е.Н.
Stylish Window Treatments Ideas
Statewide Workforce Planning Update
Бібліотека як третє місце
Bloque 4 imagen y sonido
Bloque 2 elementos de configuración formal
Bloque 2 tecnicas de dibujo
Ad

Similar to CMSC 350 HOMEWORK 3 (20)

DOCX
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
DOCX
611+tutorial
PPTX
Ds 111011055724-phpapp01
PDF
Lecture notes data structures tree
DOC
for sbi so Ds c c++ unix rdbms sql cn os
PDF
PPTX
Tree structure and its definitions with an example
DOC
Technical aptitude questions_e_book1
PPTX
Data structure tree- advance
PPTX
DS MCQS.pptx
PPTX
Data Structures
PPTX
17. Java data structures trees representation and traversal
PPTX
Data Structure
PPTX
Data structure tree - intermediate
PDF
L&NDeltaTalk
PDF
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
DOC
algorithm Unit 5
PDF
Trees unit 3
PDF
Binary trees
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
611+tutorial
Ds 111011055724-phpapp01
Lecture notes data structures tree
for sbi so Ds c c++ unix rdbms sql cn os
Tree structure and its definitions with an example
Technical aptitude questions_e_book1
Data structure tree- advance
DS MCQS.pptx
Data Structures
17. Java data structures trees representation and traversal
Data Structure
Data structure tree - intermediate
L&NDeltaTalk
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
algorithm Unit 5
Trees unit 3
Binary trees

More from HamesKellor (20)

PDF
CMST 290 FINAL EXAM
PDF
CMST 301 PROJECT 1 CASE STUDY
PDF
CMSC 350 PROJECT 3
PDF
CMSC 350 PROJECT 4
PDF
CMSC 350 PROJECT 4
PDF
CMSC 350 PROJECT 1
PDF
CMSC 350 FINAL PROJECT
PDF
CMSC 350 HOMEWORK 2
PDF
CMSC 335 HOMEWORK 3
PDF
CMSC 330 PROJECT 1
PDF
CMSC 335 FINAL PROJECT
PDF
CMSC 330 QUIZ 4
PDF
CMIT 425 RISK ASSESSMENT PAPER
PDF
CMIT 391 LINUX IMPLEMENTATION PROPOSAL
PDF
CMIT/265 FINAL PROJECT NETWORK DESIGN PROPOSAL
PDF
CMIT 321 WEEK 2 QUIZ.
PDF
CMIT 370 FINAL EXAM
PDF
CMIT 350 FINAL EXAM CCNA CERTIFICATION PRACTICE EXAM
PDF
CMIT 321 QUIZ 4
PDF
CMIT 321 WEEK 2 QUIZ
CMST 290 FINAL EXAM
CMST 301 PROJECT 1 CASE STUDY
CMSC 350 PROJECT 3
CMSC 350 PROJECT 4
CMSC 350 PROJECT 4
CMSC 350 PROJECT 1
CMSC 350 FINAL PROJECT
CMSC 350 HOMEWORK 2
CMSC 335 HOMEWORK 3
CMSC 330 PROJECT 1
CMSC 335 FINAL PROJECT
CMSC 330 QUIZ 4
CMIT 425 RISK ASSESSMENT PAPER
CMIT 391 LINUX IMPLEMENTATION PROPOSAL
CMIT/265 FINAL PROJECT NETWORK DESIGN PROPOSAL
CMIT 321 WEEK 2 QUIZ.
CMIT 370 FINAL EXAM
CMIT 350 FINAL EXAM CCNA CERTIFICATION PRACTICE EXAM
CMIT 321 QUIZ 4
CMIT 321 WEEK 2 QUIZ

Recently uploaded (20)

PPTX
Theory of Change. AFH-FRDP OCEAN ToCpptx
PPTX
A slide for students with the advantagea
PPTX
formulation and evaluation of polyherbal antiageing cream
PPTX
employee on boarding for jobs for freshers try it
PPTX
Opioid_Analgesics_Presentation (1).pptxp
PPTX
ANN DL UNIT 1 ANIL 13.10.24.pptxcccccccccc
PPTX
mathsportfoliomanvi-211121071838 (1).pptx
PDF
ELA Parts of Speech Pronoun Educational Presentation in Green 3D Gradient Sty...
PPTX
STS CHAP 4 human development as reflected
PPTX
Slideham presentation for the students a
PPTX
_Dispute Resolution_July 2022.pptxmhhghhhh
PPT
ppt-of-extraction-of-metals-12th-1.pptb9
PDF
APNCET2025RESULT Result Result 2025 2025
PPTX
CYBER SECURITY PPT.pptx CYBER SECURITY APPLICATION AND USAGE
PDF
servsafecomprehensive-ppt-full-140617222538-phpapp01.pdf
PPTX
UNIT 1 about all the important topics that you need
PPT
notes_Lecture2 23l3j2 dfjl dfdlkj d 2.ppt
PDF
Sheri Ann Lowe Compliance Strategist Resume
PPT
NO000387 (1).pptsbsnsnsnsnsnsnsmsnnsnsnsjsnnsnsnsnnsnnansnwjwnshshshs
PDF
Branding_RAMP-ML........................
Theory of Change. AFH-FRDP OCEAN ToCpptx
A slide for students with the advantagea
formulation and evaluation of polyherbal antiageing cream
employee on boarding for jobs for freshers try it
Opioid_Analgesics_Presentation (1).pptxp
ANN DL UNIT 1 ANIL 13.10.24.pptxcccccccccc
mathsportfoliomanvi-211121071838 (1).pptx
ELA Parts of Speech Pronoun Educational Presentation in Green 3D Gradient Sty...
STS CHAP 4 human development as reflected
Slideham presentation for the students a
_Dispute Resolution_July 2022.pptxmhhghhhh
ppt-of-extraction-of-metals-12th-1.pptb9
APNCET2025RESULT Result Result 2025 2025
CYBER SECURITY PPT.pptx CYBER SECURITY APPLICATION AND USAGE
servsafecomprehensive-ppt-full-140617222538-phpapp01.pdf
UNIT 1 about all the important topics that you need
notes_Lecture2 23l3j2 dfjl dfdlkj d 2.ppt
Sheri Ann Lowe Compliance Strategist Resume
NO000387 (1).pptsbsnsnsnsnsnsnsmsnnsnsnsjsnnsnsnsnnsnnansnwjwnshshshs
Branding_RAMP-ML........................

CMSC 350 HOMEWORK 3

  • 1. Buy here: 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. 2.(15 points) 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.(10 points) 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 4.(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 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.(10 points) 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.(30 points) 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
  • 2. this method should be:void listLinks ()And you will use a method with the following signature:List <Node> getChildren ()