日复一日

厚积薄发|跳跃的人生

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
在双向链表中删除指定元素。

 1void del(List head, List node){
 2    List pre=new List();
 3    pre.next = head;
 4    List cur = head;
 5    while(cur && cur!=node){
 6        cur=cur.next;
 7        pre=pre.next;
 8    }

 9    if(!cur) return;
10    List post = cur.next;
11    pre.next=cur.next;
12    post.last=cur.last;
13    return;
14}
posted on 2006-06-17 08:53  GwQ  阅读(787)  评论(0编辑  收藏  举报