private STNode<Key, Value> delete(STNode<Key, Value> x, Key key)
	{
		if (x == null)
			return null;

		int cmp = key.compareTo(x.key);
		if (cmp < 0)
			x.left = delete(x.left, key);
		else if (cmp > 0)
			x.right = delete(x.right, key);
		else
		{// cmp == 0, delete x
			if (x.left == null)
				return x.right;
			else if (x.right == null)
				return x.left;

			STNode<Key, Value> t = x; // temporary pointer to the node to be
										// deleted
			x = min(t.right); // get the inorder successor of t. successor
								// cannot have a left child
			x.right = deleteMin(t.right); // right subtree = t.right - succesor
			x.left = t.left;
		}

		// Update size and height on the way up
		x.N = size(x);
		x.h = height(x);

		return x;
	}