Esempio n. 1
0
        static LinkedNode ReverseLinkedNode(LinkedNode node)
        {
            LinkedNode head      = node;
            LinkedNode previouse = null;

            while (head.Next != null)
            {
                LinkedNode temp = head;
                head      = head.Next;
                temp.Next = previouse;
                previouse = temp;
            }

            head.Next = previouse;

            return(head);
        }
Esempio n. 2
0
        static LinkedNode IntialLinkedNode()
        {
            LinkedNode node1 = new LinkedNode()
            {
                data = "1"
            };
            LinkedNode node2 = new LinkedNode()
            {
                data = "2"
            };
            LinkedNode node3 = new LinkedNode()
            {
                data = "3"
            };
            LinkedNode node4 = new LinkedNode()
            {
                data = "4"
            };

            node1.Next = node2;
            node2.Next = node3;
            node3.Next = node4;
            return(node1);
        }