diff --git a/src/main/kotlin/trees/avl/AvlTree.kt b/src/main/kotlin/trees/avl/AvlTree.kt index 1838e06..739fcf6 100644 --- a/src/main/kotlin/trees/avl/AvlTree.kt +++ b/src/main/kotlin/trees/avl/AvlTree.kt @@ -8,22 +8,6 @@ class AvlTree, V> : AbstractTree>() { override fun iterator(): Iterator> = AvlTreeIterator(getPairs()) - private fun getPairs(): MutableList> { - val trajectory = mutableListOf>() - val stack: MutableList?> - var currNode: AvlNode? = root ?: return mutableListOf() - stack = mutableListOf(currNode) - while (stack.size > 0) { - currNode = stack[stack.size - 1] - stack.removeAt(stack.size - 1) - if (currNode != null) { - stack.add(currNode.left) - stack.add(currNode.right) - trajectory.add(Pair(currNode.key, currNode.value)) - } - } - return trajectory - } private fun balanceFactor(node: AvlNode) = (node.right?.height ?: 0) - (node.left?.height ?: 0) @@ -110,4 +94,4 @@ class AvlTree, V> : AbstractTree>() { -} \ No newline at end of file +}