public ThreadedBinaryTreeNode <T> InsertRight(T value) { ThreadedBinaryTreeNode <T> node = new ThreadedBinaryTreeNode <T>(value); ThreadedBinaryTreeNode <T> right = Right; bool isRT = IsRightThreaded; SetRight(node); this.isRightThreaded = false; node.SetRight(right); node.isRightThreaded = isRT; node.isLeftThreaded = true; node.SetLeft(this); if (!isRT) { ThreadedBinaryTreeNode <T> n = right; while (!n.isLeftThreaded) { n = n.Left; } n.SetLeft(node); } return(node); }