Interview Question
Mid of linklist:
we could have two pointer
mid => increments once every
last => increments twice
when the last reaches the end of the link list, mid will hold the middle of the link list.
while(last->next != null and last->next->next !=null) {
last = last->next->next;
mid = mid->next();
}
of course this code need to improvised.
Somebody answer it.
- Abhishek Ameria April 28, 2011