public ReverseTree <T> Find(T key)
        {
            if (!_seachDictionary.TryGetValue(key, out ReverseTree <T> objRet))
            {
                objRet = new ReverseTree <T>(key); // single tree with only key
            }

            return(objRet);
        }
        /// <summary>
        /// Returns an enumerator that iterates through the collection.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
        /// </returns>
        public IEnumerator <T> GetEnumerator()
        {
            ReverseTree <T> current = this;

            yield return(current._self);

            while (current._parent != null)
            {
                current = current._parent;
                yield return(current._self);
            }
        }
 private void setRoot(ReverseTree <T> root)
 {
     /*
      * if (_children != null)
      * {
      *  foreach (ReverseTree<T> reverseTree in _children)
      *  {
      *      reverseTree.setRoot(root);
      *  }
      * }
      */
     _root = root;
     foreach (KeyValuePair <T, ReverseTree <T> > keyValuePair in _seachDictionary)
     {
         root._seachDictionary.Add(keyValuePair.Key, keyValuePair.Value);
     }
     _seachDictionary = root._seachDictionary;
 }