public int MidNode() throws Exception {
int mid = (getSize()-1)/2;
Node temp = GetNodeAt(mid);
return temp.data;
}
Below are simple way to get the MidNode... why didn't you use this?
@vashisthdeepak928
yeah! its a brute force approach but if suppose you interviewer ask to solve this without taking the size of the linked list.
Okay got it.
Thanks!