To class Tree that represents binary search tree (BST), add the following method: 1- printByLevel ( ) which prints the nodes in the tree level by level, it prints all nodes in a specific level before...


To class Tree that represents binary search tree (BST), add the following method:<br>1- printByLevel ( ) which prints the nodes in the tree level by level,<br>it prints all nodes in a specific level before moving to the nodes<br>at the next depth level. For example this tree should be printed as<br>follows:<br>11 6 19 4 8 17 43 5 10 31 49<br>Hint: you need to use a queue.<br>2- nodesInLevel(int x): it returns number of nodes in a specific level x. for example in this tree,<br>nodesInLevel(2) is 4<br>Hint: this method should call a recursive method.<br>

Extracted text: To class Tree that represents binary search tree (BST), add the following method: 1- printByLevel ( ) which prints the nodes in the tree level by level, it prints all nodes in a specific level before moving to the nodes at the next depth level. For example this tree should be printed as follows: 11 6 19 4 8 17 43 5 10 31 49 Hint: you need to use a queue. 2- nodesInLevel(int x): it returns number of nodes in a specific level x. for example in this tree, nodesInLevel(2) is 4 Hint: this method should call a recursive method.

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here