2
0
Simon Krajewski 12 жил өмнө
parent
commit
61c1fa205e

+ 2 - 2
std/haxe/ds/BalancedTree.hx

@@ -98,16 +98,16 @@ class BalancedTree<K,V> {
 	
 	
 	function iteratorLoop(node:TreeNode<K,V>, acc:Array<V>) {
 	function iteratorLoop(node:TreeNode<K,V>, acc:Array<V>) {
 		if (node != null) {
 		if (node != null) {
-			acc.push(node.value);
 			iteratorLoop(node.left, acc);
 			iteratorLoop(node.left, acc);
+			acc.push(node.value);
 			iteratorLoop(node.right, acc);
 			iteratorLoop(node.right, acc);
 		}
 		}
 	}
 	}
 	
 	
 	function keysLoop(node:TreeNode<K,V>, acc:Array<K>) {
 	function keysLoop(node:TreeNode<K,V>, acc:Array<K>) {
 		if (node != null) {
 		if (node != null) {
-			acc.push(node.key);
 			keysLoop(node.left, acc);
 			keysLoop(node.left, acc);
+			acc.push(node.key);
 			keysLoop(node.right, acc);
 			keysLoop(node.right, acc);
 		}
 		}
 	}
 	}