1. Complete the implementation of getRoot and toString.

2. Complete the implementation of size and isEmpty operations of a binary tree, assuming that there is not a count variable.

3. Create boolean methods for our BinaryTreeNode class to determine if the node is a leaf or a an internal node.

4. Create a method called depth that will return an int representing the level or depth of the given node from the root.

5. Complete the implementation of the contains method for a binary tree.

Similar to the prior projects your program should provide a command-line user interface that accepts the following commands. These commands will operate on a binary tree whose nodes contain integer values.

1. print

This command should print the contents of the binary tree using the following output format:

a. A leaf node containing the integer value, x, should be displayed as:

( x )

b. A non-leaf node containing the integer value, x, should be displayed as:

(x subtree1 subtree2)

where subtree1 and subtree2 represents the display generated by recursively applying rules a. and b. If either subtree1 or subtree2 is empty the empty subtree will be displayed as:

()

Example: A binary tree of integers of depth 3 with the structure:

1

11 12

111 112 122

would display as:

( 1 (11 (111) (112)) (12 () (122)))

2. size

This command should print the number of nodes in the tree.

3. depth val_integer

This command should determine if the tree contains the value val_integer. If so, then the command should print the depth of that node in the tree. If the value is not present, print an error message:

The tree does not contain the value val_integer.

4. contains val_integer

This command should determine if the tree contains the value val_integer. If so, then the command should print:

The tree contains the value val_integer.

The node is node_type.

where node_type is the phrase: “the root”, “a leaf”, or “an internal node” depending on whether the found node is one of those types of nodes.

If the tree does not contain the node, print the error message:

The tree does not contain the value val_integer.

5. set tree

This command sets the binary tree to be the tree tree, where tree is sequence of characters that describe a binary tree of integers using the same syntax as the display syntax for the print command. More precisely the rules that describe the syntax are as follows. ( | separates different options):

Tree ( ) | ( integer ) | (integer Tree Tree)

Examples:

set (1 (11 (111) (112)) (12 () (122)))

set ( 1 )

set ( 1 () () )

set ( 1 () (2 (3) () ) )

2. Complete the implementation of size and isEmpty operations of a binary tree, assuming that there is not a count variable.

3. Create boolean methods for our BinaryTreeNode class to determine if the node is a leaf or a an internal node.

4. Create a method called depth that will return an int representing the level or depth of the given node from the root.

5. Complete the implementation of the contains method for a binary tree.

Similar to the prior projects your program should provide a command-line user interface that accepts the following commands. These commands will operate on a binary tree whose nodes contain integer values.

1. print

This command should print the contents of the binary tree using the following output format:

a. A leaf node containing the integer value, x, should be displayed as:

( x )

b. A non-leaf node containing the integer value, x, should be displayed as:

(x subtree1 subtree2)

where subtree1 and subtree2 represents the display generated by recursively applying rules a. and b. If either subtree1 or subtree2 is empty the empty subtree will be displayed as:

()

Example: A binary tree of integers of depth 3 with the structure:

1

11 12

111 112 122

would display as:

( 1 (11 (111) (112)) (12 () (122)))

2. size

This command should print the number of nodes in the tree.

3. depth val_integer

This command should determine if the tree contains the value val_integer. If so, then the command should print the depth of that node in the tree. If the value is not present, print an error message:

The tree does not contain the value val_integer.

4. contains val_integer

This command should determine if the tree contains the value val_integer. If so, then the command should print:

The tree contains the value val_integer.

The node is node_type.

where node_type is the phrase: “the root”, “a leaf”, or “an internal node” depending on whether the found node is one of those types of nodes.

If the tree does not contain the node, print the error message:

The tree does not contain the value val_integer.

5. set tree

This command sets the binary tree to be the tree tree, where tree is sequence of characters that describe a binary tree of integers using the same syntax as the display syntax for the print command. More precisely the rules that describe the syntax are as follows. ( | separates different options):

Tree ( ) | ( integer ) | (integer Tree Tree)

Examples:

set (1 (11 (111) (112)) (12 () (122)))

set ( 1 )

set ( 1 () () )

set ( 1 () (2 (3) () ) )

### Recently Asked Questions

- what other processes could be emplemented to support and ensure staff are awer of thier required performance standards and how thier performance is measured?

- Wilcoxon Ranked Sum Test Critical Value table, for example the critical value is 12,28 which means W<12 and W>28 is rejection, but which one should I use if

- Choose all probability distributions which are theoretically related to normal probability istribution A) Chi Square B) F C) Student's t D) Z E) Morphet's Q F)