Exemplo n.º 1
0
        public void PrintReverse()
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = FindLastNode();

            while (currentNodeBiDirection.BLink != null)
            {
                Console.WriteLine(currentNodeBiDirection.Element);
                currentNodeBiDirection = currentNodeBiDirection.BLink;
            }
        }
Exemplo n.º 2
0
        private NodeBiDirectionMy <T> Find(T elememt)
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = _header;

            while (currentNodeBiDirection != null && !currentNodeBiDirection.Element.Equals(elememt))
            {
                currentNodeBiDirection = currentNodeBiDirection.FLink;
            }
            return(currentNodeBiDirection);
        }
Exemplo n.º 3
0
        private NodeBiDirectionMy <T> FindLastNode()
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = _header;

            while (currentNodeBiDirection.FLink != null)
            {
                currentNodeBiDirection = currentNodeBiDirection.FLink;
            }
            return(currentNodeBiDirection);
        }
Exemplo n.º 4
0
        public void PrintLinkedList()
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = _header;

            while (currentNodeBiDirection.FLink != null)
            {
                Console.WriteLine(currentNodeBiDirection.FLink.Element);
                currentNodeBiDirection = currentNodeBiDirection.FLink;
            }
        }
Exemplo n.º 5
0
        public void Remove(T element)
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = Find(element);

            if (currentNodeBiDirection != null)
            {
                if (currentNodeBiDirection.FLink != null)
                {
                    currentNodeBiDirection.FLink.BLink = currentNodeBiDirection.BLink;
                    currentNodeBiDirection.BLink.FLink = currentNodeBiDirection.FLink;
                }
                else
                {
                    currentNodeBiDirection.BLink.FLink = null;
                }
            }
        }
Exemplo n.º 6
0
        public void Insertion(T newElement, T after)
        {
            NodeBiDirectionMy <T> newNodeBiDirection     = new NodeBiDirectionMy <T>(newElement);
            NodeBiDirectionMy <T> currentNodeBiDirection = Find(after);

            if (currentNodeBiDirection != null)
            {
                if (currentNodeBiDirection.FLink != null)
                {
                    currentNodeBiDirection.FLink.BLink = newNodeBiDirection;
                    newNodeBiDirection.FLink           = currentNodeBiDirection.FLink;
                    newNodeBiDirection.BLink           = currentNodeBiDirection;
                    currentNodeBiDirection.FLink       = newNodeBiDirection;
                }
                else
                {
                    newNodeBiDirection.FLink     = null;
                    newNodeBiDirection.BLink     = currentNodeBiDirection;
                    currentNodeBiDirection.FLink = newNodeBiDirection;
                }
            }
        }
Exemplo n.º 7
0
 public LinkedListBiDirectionMy(T header)
 {
     _header = new NodeBiDirectionMy <T>(header);
 }
Exemplo n.º 8
0
 public NodeBiDirectionMy(T element)
 {
     Element = element;
     BLink   = null;
     FLink   = null;
 }
Exemplo n.º 9
0
 public NodeBiDirectionMy()
 {
     Element = default(T);
     BLink   = null;
     FLink   = null;
 }
Exemplo n.º 10
0
 public LinkedListCircularMy(T header)
 {
     _header       = new NodeBiDirectionMy <T>(header);
     _header.FLink = _header;
 }
Exemplo n.º 11
0
 public LinkedListCircularMy()
 {
     _header = new NodeBiDirectionMy <T>();
 }