Example #1
0
        public MyLinkedList GetNode(int index)
        {
            if (index < 0)
            {
                return(this);
            }
            int          i        = 0;
            MyLinkedList currNode = this.Next;

            while (i < index)
            {
                if (currNode != null)
                {
                    currNode = currNode.Next;
                }
                else
                {
                    break;
                }
                i++;
            }

            return(currNode);
        }
Example #2
0
 public MyLinkedList(int val, MyLinkedList next)
 {
     this.Val  = val;
     this.Next = next;
 }
Example #3
0
 public MyLinkedList()
 {
     this.Val  = -1;
     this.Next = null;
 }