Wednesday, November 14th, 2007 Posted in C++ object oriented Interview Questions | No Comments »
How do you write a function that can reverse a linked-list? void reverselist(void) { if(head==0) return; if(head->next==0) return; if(head->next==tail) { head->next = 0; tail->next = head; } else { node* pre = head; node* cur = head->next; node* curnext = cur->next; head->next = 0; cur->next = head; for(; curnext!=0; ... Read more..