Пример #1
0
        public void PrintReverse()
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = FindLastNode();

            while (currentNodeBiDirection.BLink != null)
            {
                Console.WriteLine(currentNodeBiDirection.Element);
                currentNodeBiDirection = currentNodeBiDirection.BLink;
            }
        }
Пример #2
0
        private NodeBiDirectionMy <T> Find(T elememt)
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = _header;

            while (currentNodeBiDirection != null && !currentNodeBiDirection.Element.Equals(elememt))
            {
                currentNodeBiDirection = currentNodeBiDirection.FLink;
            }
            return(currentNodeBiDirection);
        }
Пример #3
0
        private NodeBiDirectionMy <T> FindLastNode()
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = _header;

            while (currentNodeBiDirection.FLink != null)
            {
                currentNodeBiDirection = currentNodeBiDirection.FLink;
            }
            return(currentNodeBiDirection);
        }
Пример #4
0
        public void PrintLinkedList()
        {
            NodeBiDirectionMy <T> currentNodeBiDirection = _header;

            while (currentNodeBiDirection.FLink != null)
            {
                Console.WriteLine(currentNodeBiDirection.FLink.Element);
                currentNodeBiDirection = currentNodeBiDirection.FLink;
            }
        }
Пример #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;
                }
            }
        }
Пример #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;
                }
            }
        }
Пример #7
0
 public LinkedListBiDirectionMy(T header)
 {
     _header = new NodeBiDirectionMy <T>(header);
 }
Пример #8
0
 public NodeBiDirectionMy(T element)
 {
     Element = element;
     BLink   = null;
     FLink   = null;
 }
Пример #9
0
 public NodeBiDirectionMy()
 {
     Element = default(T);
     BLink   = null;
     FLink   = null;
 }
Пример #10
0
 public LinkedListCircularMy(T header)
 {
     _header       = new NodeBiDirectionMy <T>(header);
     _header.FLink = _header;
 }
Пример #11
0
 public LinkedListCircularMy()
 {
     _header = new NodeBiDirectionMy <T>();
 }