public static ListNode sortList(ListNode head){
		

		
        //check wheather the linked list is null
        if(head==null||head.next==null){
            return head;
        }else{
        	
        	ListNode mid = findMiddle(head);
        	
        	ListNode right = sortList(mid.next);
        	mid.next=null;
        	ListNode left = sortList(head);
        	
        	return mergeSorted(left,right);
        	
        }
        
	}