Question: Given the following 2 input files, input1.txt & input2.txt, I need help creating a m-ary tree . A m-ary tree is a type of tree
Given the following 2 input files, input1.txt & input2.txt, I need help creating a m-ary tree. A m-ary tree is a type of tree where every internal node has no more than m children. I cannot use any built in Java Collections Framework classes anywhere in your program such as ArrayList, LinkedList, HashSet, etc
input1.txt: 3 A B C D G H I _ _ _ E F _ _ _ _ _ _ _ J _ _ _ _ _ _ _ _ _ _ _ _ _ _ K L _ _ _ _
input2.txt: 4 A B C D E F _ _ _ G H _ _ _ _ _ _ I J K L
From an input text file, read the nodes and construct an m-ary tree. Format of input.txt is given below:

Explanation: First character represents m of the m-ary tree. It is the maximum number of children a node can have. Next character is the root node. Root node is followed by level 1 nodes which are roots children in order from left to right. Then, followed by level 2 nodes which are level 1 nodes children and so on. If a node does not have the maximum m children, the space for those children will be filled by the underscore symbol. i.e. _ is just a placeholder for empty children. It should only be used to figuring out whose children are whose. For examples, for a 3-ary tree, the input text file starts with 3. The 3 0 characters for level 1 nodes, 3 1characters for level 2 nodes, 3 2 characters for level 3 nodes, and so on. Each character is separated by one empty space . Sample input files given with the assignment: input1.txt, input2.txt

Example 1 3 A BCDGHI--- Represents the following 3-ary tree: Example 1 3 A BCDGHI--- Represents the following 3-ary tree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
