Beispiel #1
0
        public IEnumerable <T> PreOrden()
        {
            yield return(Key);

            if (Left != null)
            {
                var l = Left.PreOrden();
                foreach (var item in l)
                {
                    yield return(item);
                }
            }
            if (Rigth != null)
            {
                var r = Rigth.PreOrden();
                foreach (var item in r)
                {
                    yield return(item);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// The pre-order walk on tree
 /// </summary>
 /// <returns></returns>
 public IEnumerable <T> PreOrden()
 {
     return(Count > 0 ? C_Root.PreOrden() : C_Root.EmptyEnum());
 }