public int middle(Node head){
        if(head == null || head.next == null){
            return head.data;
        }
        
        Node slow = head;
        Node fast = head.next;
        while(fast != null && fast.next != null){
            slow = slow.next;
            fast = fast.next.next;
        }
        return slow.data;
    }
Find middle element in linklist.
Use two pointer approach.
Test cases
0,1,2,3,4 and so on nodes
@author tusroy
src/com/interview/linklist/MiddleElementOfLinkList.java