Suppose we have 5 String arrays:
String[] array1 = {"hello", "i", "cat"};
String[] array2 = {"hello", "i", "am"};
String[] array3 = {"hello", "James"};'
String[] array4 = {"hello", "i", "bob"};
String[] array5 = {"hello", "mike", "wasup"};
How would I create a tree where "hello" is always the root, and the second element is the child of the root and and the other elements become the children of the sub root. (each node could have 0-n node children)
An an example:
hello
/ \ \
i james mike
/ \ \ /
cat am bob wasup
The diagram above is a type of tree I want. Please don't write any code. I want to understand the concept. Explain your approach as a programmer.