C++ || Two approaches || Easy solution
APPROACH 1:\nTraverse the linked list to find it\'s length.\nFind the middle in the second traversal (middle is length/2)\nReturn pointer pointing to the middle
**APPROACH 1:**\nTraverse the linked list to find it\'s length.\nFind the middle in the second traversal (middle is length/2)\nReturn pointer pointing to the middle element.\n```\nclass Solution {\npublic:\n    ListNode* middleNode(ListNode* head) {\n        ListNode *temp = head;\n        int length=0;\n        while(temp)\n        {\n            length++;\n            temp = temp->next;\n        }\n        int half = length/2;\n        temp=head;\n        while(temp && half--)\n        {\n            temp=temp->next;\n        }\n        return temp;\n    }\n};\n```\nRuntime: 0 ms, faster than 100.00% of C++ online submissions for Middle of the Linked List.\nMemory Usage: 7.1 MB, less than 20.80% of C++ online submissions for Middle of the Linked List.\n\n**APPROACH-2**\nKeep 2 pointers, slow and fast. \nslow moves by one step whereas fast moves by 2 steps.\nBy the time fast reaches the end of the LL, slow will point to the middle.\n```\nclass Solution {\npublic:\n    ListNode* middleNode(ListNode* head) {\n        ListNode* slow = head;\n        ListNode* fast = head;\n        while(fast!=NULL && fast->next!=NULL)\n        {\n            slow= slow->next;\n            fast= fast->next->next;\n        }\n        return slow;\n    }\n};\n```\nRuntime: 4 ms\nMemory Usage: 7.2 MB\n\n**FEEL FREE TO ASK ANYTHING IN THE COMMENTS BELOW!!\nPLZ DO UPVOTE IF YOU LIKE MY SOLUTION :)**\n
['Linked List', 'C', 'C++']