Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How do you write a function that can reverse a linked-list?
How do you write a function that can reverse a linked-list?
✍: Guest
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; ) { cur->next = pre; pre = cur; cur = curnext; curnext = curnext->next; } curnext->next = cur; } }
2012-01-26, 2499👍, 0💬
Popular Posts:
What is CAR (Causal Analysis and Resolution)? The basic purpose of CAR is to analyze all defects, pr...
Which bit wise operator is suitable for checking whether a particular bit is on or off? The bitwise ...
How do you override a defined macro? You can use the #undef preprocessor directive to undefine (over...
what is a service contract, operation contract and Data Contract? - part 1 In the below sample we ha...
How To Insert Multiple Rows with a SELECT Statement? - MySQL FAQs - Managing Tables and Running Quer...