equal
deleted
inserted
replaced
3 |
3 |
4 This class is provided as-is, without any warranty. |
4 This class is provided as-is, without any warranty. |
5 It is not part of or covered by the ST/X copyright. |
5 It is not part of or covered by the ST/X copyright. |
6 " |
6 " |
7 "{ Package: 'stx:libbasic2' }" |
7 "{ Package: 'stx:libbasic2' }" |
|
8 |
|
9 "{ NameSpace: Smalltalk }" |
8 |
10 |
9 Object subclass:#BinaryTreeNode |
11 Object subclass:#BinaryTreeNode |
10 instanceVariableNames:'data leftSubtree rightSubtree' |
12 instanceVariableNames:'data leftSubtree rightSubtree' |
11 classVariableNames:'' |
13 classVariableNames:'' |
12 poolDictionaries:'' |
14 poolDictionaries:'' |
151 self inOrderDo:[:eachNode | aBlock value:eachNode data] |
153 self inOrderDo:[:eachNode | aBlock value:eachNode data] |
152 ! |
154 ! |
153 |
155 |
154 inOrderDo:aBlock |
156 inOrderDo:aBlock |
155 "Traverses the elements of the binary tree in |
157 "Traverses the elements of the binary tree in |
156 LEFT - ROOT - RIGHT order, |
158 LEFT - ROOT - RIGHT order, |
157 applying a block to each node. |
159 applying a block to each node. |
158 |
160 |
159 We use an interative approach here, to avoid VM stack overflow" |
161 We use an iterative approach here, to avoid VM stack overflow" |
160 |
162 |
161 |nextNode stack| |
163 |nextNode stack| |
162 |
164 |
163 stack := Stack new. |
165 stack := Stack new. |
164 nextNode := self. |
166 nextNode := self. |
620 ! ! |
622 ! ! |
621 |
623 |
622 !BinaryTreeNode class methodsFor:'documentation'! |
624 !BinaryTreeNode class methodsFor:'documentation'! |
623 |
625 |
624 version |
626 version |
625 ^ '$Header: /cvs/stx/stx/libbasic2/BinaryTreeNode.st,v 1.9 2013-04-08 14:36:27 stefan Exp $' |
627 ^ '$Header$' |
626 ! |
628 ! |
627 |
629 |
628 version_CVS |
630 version_CVS |
629 ^ '$Header: /cvs/stx/stx/libbasic2/BinaryTreeNode.st,v 1.9 2013-04-08 14:36:27 stefan Exp $' |
631 ^ '$Header$' |
630 ! ! |
632 ! ! |
631 |
633 |