首页 > 其他 > 详细

链表反转

时间:2014-02-25 11:55:58      阅读:339      评论:0      收藏:0      [点我收藏+]

面试里面的另外一个特别容易出的题目 反转链表


void reverselist(node** head){


    if(*head == NULL) return ;
    node* pre = NULL;
    node* cur = *head;
    node* next = *head;
    while(cur){
        next = cur->next;
        cur -> next = pre;
        pre = cur;
        cur = next;
    }
    *head = pre;
}


链表反转

原文:http://blog.csdn.net/shcalm/article/details/19821095

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!