日复一日

厚积薄发|跳跃的人生

  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  25 随笔 :: 2 文章 :: 6 评论 :: 0 Trackbacks
在双向链表中删除指定元素。

 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-16 20:52 GwQ 阅读(195) 评论(0)  编辑 收藏 引用 所属分类: 微软面试技术题
只有注册用户登录后才能发表评论。