Convert List into Tree with n levels



We have a list that contains n levels of items separated by dots.We have to arrange them in a tree,example:



A.B.C.D.a.
A.B.C.D.b.
A.B.C.D.b.1.
A.B.C.D.b.2.
AB.B.C.D.a.
AB.B.C.D.b.
AB.B.C.D.c.
AB.B.C.D.e.


Result expected in following format :



Level 1 2 3 4 5 6
A B C D a
b 1
b 2
AB B C D a
D b
D c
D e

No comments:

Post a Comment