/// <summary>
        /// Gets the next Node from the tree in order after the given Node.
        /// </summary>
        /// <param name="afterNode">The Node of discussion.</param>
        /// <returns>The Node in the binary tree has the closes bigger value to the afterNode.</returns>
        private BinaryTreeNode nextNodeInOrder(BinaryTreeNode afterNode)
        {
            if (afterNode.rightChild != null)
            {
                this.amortizedComplexity += this.getAmortizedComplexity(afterNode, afterNode.rightChild);
                BinaryTreeNode leftmostNode = this.leftmostNodeUnder(afterNode.rightChild);

                if (leftmostNode != null)
                    return leftmostNode;

                return afterNode.rightChild;
            }
            else if (afterNode.parentNode != null)
            {
                if (afterNode.isLeftChild())
                {
                    this.amortizedComplexity += this.getAmortizedComplexity(afterNode, afterNode.parentNode);
                    return afterNode.parentNode;
                }
                else
                    return firstNotVisitedParent(afterNode);
            }
             return null;
        }
        public void testIsLeftChild()
        {
            BinaryTreeNode rootNode = new BinaryTreeNode(2);
            BinaryTreeNode leftChild = new BinaryTreeNode(1, rootNode);
            BinaryTreeNode rightChild = new BinaryTreeNode(3, rootNode);

            Assert.IsFalse(rootNode.isLeftChild());
            Assert.IsTrue(leftChild.isLeftChild());
            Assert.IsFalse(rightChild.isLeftChild());
        }