private static void appendNode(ref LinkedList.ListNode currNode, ref LinkedList.ListNode source)
 {
     LinkedList.ListNode temp = currNode; // hold current node in a temp node
     currNode  = currNode.next;           // move ahead
     temp.next = source;                  // join node to the source
     source    = temp;                    // copy node to source
 }
        private static void sortedIntersect()
        {
            LinkedList.ListNode firstCurrNode  = firstlinkedList.list;
            LinkedList.ListNode secondCurrNode = secondlinkedList.list;

            while (firstCurrNode != null && secondCurrNode != null)
            {
                if (firstCurrNode.info.CompareTo(secondCurrNode.info) == 0) // if both element are same
                {
                    LinkedList.ListNode temp = firstCurrNode;               // copy value into a temp node
                    firstCurrNode  = firstCurrNode.next;                    // move ahead
                    secondCurrNode = secondCurrNode.next;                   //move ahead
                    temp.next      = newLinkedlist;
                    newLinkedlist  = temp;
                }
                else if (firstCurrNode.info.CompareTo(secondCurrNode.info) < 0) // first node < second node
                {
                    firstCurrNode = firstCurrNode.next;
                }
                else
                {
                    secondCurrNode = secondCurrNode.next; // second node < first node
                }
            }
        }
        public static void frontBackSplit()
        {
            int len = linkedList.numItems;

            LinkedList.ListNode front = null;
            LinkedList.ListNode back  = null;

            LinkedList.ListNode currNode = linkedList.list;

            if (len < 2)
            {
                front = linkedList.list;
                back  = null;
            }
            else
            {
                for (int i = 0; i < (len - 1) / 2; i++)
                {
                    currNode = currNode.next;
                }

                front         = linkedList.list;
                back          = currNode.next;
                currNode.next = null;
            }
        }
        private static void shuffleMerge()
        {
            LinkedList.ListNode currA = a.list;
            LinkedList.ListNode currB = b.list;

            while (currA != null || currB != null)
            {
                appendNode(ref currA, ref merged);
                appendNode(ref currB, ref merged);
            }
        }
        private static void split()
        {
            LinkedList.ListNode currNode = linkedList.list;
            LinkedList.ListNode a        = null;
            LinkedList.ListNode b        = null;

            while (currNode != null)
            {
                appendNode(ref currNode, ref a);

                if (currNode != null)
                {
                    appendNode(ref currNode, ref b);
                }
            }
        }
        private static void sortedIntersect()
        {
            LinkedList.ListNode firstCurrNode = firstlinkedList.list;
            LinkedList.ListNode secondCurrNode = secondlinkedList.list;

            while (firstCurrNode != null && secondCurrNode != null)
            {
                if (firstCurrNode.info.CompareTo(secondCurrNode.info) == 0) // if both element are same
                {
                    LinkedList.ListNode temp = firstCurrNode; // copy value into a temp node
                    firstCurrNode = firstCurrNode.next; // move ahead
                    secondCurrNode = secondCurrNode.next; //move ahead
                    temp.next = newLinkedlist;
                    newLinkedlist = temp;
                }
                else if (firstCurrNode.info.CompareTo(secondCurrNode.info) < 0) // first node < second node
                    firstCurrNode = firstCurrNode.next;
                else
                    secondCurrNode = secondCurrNode.next; // second node < first node
            }
        }