hi friends, i have a question plz help me. my question is ...
how can i find middle node of linked list in single traverse???????
how can i find middle node of linked list in single traverse???????
Type& findMiddleNode() { int check = 0; nodeType *current; nodeType *mid; current = first; mid = first; while (current != NULL) { current = current->link; check = (check + 1) % 2; if (check == 0) mid = mid->link; } return mid->info; }
Comment