@Override
	public String traverse() {
		StackBST stack = new StackBST();
		StringBuilder l = new StringBuilder();

		// induction basis:
		StackBSTelem elem = new StackBSTelem(0, root);
		stack.push(elem);

		// induction step:
		BinarySearchTreeItem<K> node;
		while (true) {
			elem = stack.top();
			node = elem.node;
			if (elem.seenChildren == 0) {
				if (node.left != null) {
					StackBSTelem elem2 = new StackBSTelem(0, node.left);
					stack.push(elem2);
				} else {
					elem.seenChildren = 1;
					l.append(elem.node.key);
				}
			} else if (elem.seenChildren == 1) {
				if (node.right != null) {
					StackBSTelem elem2 = new StackBSTelem(0, node.right);
					stack.push(elem2);
				} else {
					elem.seenChildren = 2;
				}
			} else if (elem.seenChildren == 2) {
				stack.pop();
				if (stack.isEmpty()) {
					return l.toString();
				}
				elem = stack.top();
				elem.seenChildren += 1;
				if (elem.seenChildren == 1 && elem.node.left != null) {
					l.append(elem.node.key);
				}
			}
		}
	}