(Node head)
| 174 | } |
| 175 | |
| 176 | private Node findMidNode(Node head) { |
| 177 | Node slow = head; |
| 178 | Node fast = head.next; |
| 179 | //important because we want final mid to be end of 1st half in even case, |
| 180 | //not start of 2nd half. Because mid.next is start of 2nd half. |
| 181 | |
| 182 | while(fast!= null && fast.next!=null) { |
| 183 | slow = slow.next; |
| 184 | fast = fast.next.next; |
| 185 | } |
| 186 | return slow; |
| 187 | } |
| 188 | |
| 189 | public boolean checkPalindrome() { |
| 190 | if(head == null || head.next == null) { |
no outgoing calls
no test coverage detected