int getMiddle(Node *head)
{
   int cnt=0;
   Node* temp=head;
   while(temp!=NULL)
   {
       cnt++;
       temp=temp->next;
   }
   if(cnt%2==0)cnt=(cnt/2)+1;
   else cnt=(cnt+1)/2;
   int pos=1;
   temp=head;
   while(pos!=cnt)
   {
       pos++;
       temp=temp->next;
   }
   return temp->data;
}

Time Complexity:O(N)
Space Complexity:O(1)