36 lines
952 B
Plaintext
36 lines
952 B
Plaintext
Sub ShowTree(List() As Integer)
|
|
Dim As Integer I, NestLevel = 0
|
|
For I = 0 To Ubound(List)
|
|
While List(I) < NestLevel
|
|
Print "]";
|
|
NestLevel -= 1
|
|
Wend
|
|
If List(I) = 0 Then
|
|
Print
|
|
Elseif I <> Lbound(List) Then Print ", ";
|
|
End If
|
|
While List(I) > NestLevel
|
|
Print "[";
|
|
NestLevel += 1
|
|
Wend
|
|
If NestLevel <> 0 Then Print NestLevel;
|
|
Next I
|
|
End Sub
|
|
|
|
Dim As Integer list(0 To ...) = {0}
|
|
ShowTree(list())
|
|
Dim As Integer list0(0 To ...) = {1, 2, 4, 0}
|
|
ShowTree(list0())
|
|
Dim As Integer list1(0 To ...) = {3, 1, 3, 1, 0}
|
|
ShowTree(list1())
|
|
Dim As Integer list2(0 To ...) = {1, 2, 3, 1, 0}
|
|
ShowTree(list2())
|
|
Dim As Integer list3(0 To ...) = {3, 2, 1, 3, 0}
|
|
ShowTree(list3())
|
|
Dim As Integer list4(0 To ...) = {3, 3, 3, 1, 1, 3, 3, 3, 0}
|
|
ShowTree(list4())
|
|
Dim As Integer list5(0 To ...) = {1, 2, 4, 2, 2, 1, 0}
|
|
ShowTree(list5())
|
|
|
|
Sleep
|