3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
8 # SEE: http://rosettacode.org/wiki/Tree_traversal
13 var left
: nullable Node
14 var right
: nullable Node
20 if l
!= null then l
.preorder
22 if r
!= null then r
.preorder
28 if l
!= null then l
.inorder
31 if r
!= null then r
.inorder
37 if l
!= null then l
.postorder
39 if r
!= null then r
.postorder
45 var q
= new List[Node]
51 if l
!= null then q
.push l
53 if r
!= null then q
.push r
58 var tree
= new Node(1,