예제 #1
0
        private void RecursivePreOrder(List <T> _list, MultiPathNode <T> actualNode)
        {
            if (actualNode != null)
            {
                Node <T> head = actualNode.GetHead();

                if (head != null)
                {
                    _list.Add(head.t_object);
                    Node <T> aux = head;
                    while (aux.next != null)
                    {
                        aux = aux.next;

                        _list.Add(aux.t_object);
                    }
                    aux = head;
                    RecursivePreOrder(_list, head.LeftChild);
                    RecursivePreOrder(_list, head.RightChild);
                    while (aux.next != null)
                    {
                        aux = aux.next;
                        RecursivePreOrder(_list, aux.RightChild);
                    }
                }
            }
        }
예제 #2
0
        private void OriginalRecursivePostOrder(List <T> _list, MultiPathNode <T> actualNode) //Explicado en clase
        {
            if (actualNode != null)
            {
                Node <T> head = actualNode.GetHead();
                if (head != null)
                {
                    OriginalRecursivePostOrder(_list, head.LeftChild);
                    OriginalRecursivePostOrder(_list, head.RightChild);
                    Node <T> aux = head;
                    while (aux.next != null)
                    {
                        aux = aux.next;
                        OriginalRecursivePostOrder(_list, aux.RightChild);
                    }
                    _list.Add(head.t_object);
                    aux = head;
                    while (aux.next != null)
                    {
                        aux = aux.next;

                        _list.Add(aux.t_object);
                    }
                }
            }
        }
예제 #3
0
        Node <T> FindMinor(MultiPathNode <T> actualNode)
        {
            Node <T> head = actualNode.GetHead();

            if (head.LeftChild != null)
            {
                return(FindMinor(head.LeftChild));
            }
            else
            {
                return(head);
            }
        }