Q: an ordered array is given, need to convert into a balanced binary tree and then BFSly print each level as a D-dimentional linked list
Need to understand list, vector, BFS, recursion, scope of member function, call-by-reference, class, template.
The main method is the linked list form processing.
1: push the given head into the list, then push it into a vector.
2. if the vector is not empty, push all the left/right children of the head into a temporary list, after BFS this level, push the temp list into the previous vector as output.
Here is the source code and output.