Write a recursive buildBinaryTree method that builds a new binary tree from the contents of an array that contains integers. Use the following class definition for a node in a binary tree: class BinaryNode { int element; BinaryNode left; BinaryNode right; } Hint: Take one item from the array and insert it as the root of the tree. Divide the remaining items in half and insert one half in the right subtree and the other half in the left subtree of the root node by calling the method recursively with the relevant array indices.Write a method oddEntries that returns the number of odd integers contained in a binary tree where the element type is int. This method is called with a link to the root node of the tree.
Write a recursive buildBinaryTree method that builds a new binary tree from the contents of an array that contains integers. Use the following class definition for a node in a binary tree: class BinaryNode { int element; BinaryNode left; BinaryNode right; } Hint: Take one item from the array and insert it as the root of the tree. Divide the remaining items in half and insert one half in the right subtree and the other half in the left subtree of the root node by calling the method recursively with the relevant array indices.Write a method oddEntries that returns the number of odd integers contained in a binary tree where the element type is int. This method is called with a link to the root node of the tree.
Write a recursive buildBinaryTree method that builds a new binary tree from the contents of an array that contains integers. Use the following class definition for a node in a binary tree: class BinaryNode { int element; BinaryNode left; BinaryNode right; } Hint: Take one item from the array and insert it as the root of the tree. Divide the remaining items in half and insert one half in the right subtree and the other half in the left subtree of the root node by calling the method recursively with the relevant array indices.Write a method oddEntries that returns the number of odd integers contained in a binary tree where the element type is int. This method is called with a link to the root node of the tree.
Write a recursive buildBinaryTree method that builds a new binary tree from the contents of an array that contains integers. Use the following class definition for a node in a binary tree: class BinaryNode { int element; BinaryNode left; BinaryNode right; } Hint: Take one item from the array and insert it as the root of the tree. Divide the remaining items in half and insert one half in the right subtree and the other half in the left subtree of the root node by calling the method recursively with the relevant array indices.Write a method oddEntries that returns the number of odd integers contained in a binary tree where the element type is int. This method is called with a link to the root node of the tree.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.