Algs4-1.3.24编写一个removeAfter()方法

1.3.24编写一个方法removeAfter(),接受一条链表结点作为参数并删除该结点的后续结点(如果参数结点或参数结点的后续结点为空则什么也不做)。
答:
public  removeAfter(Node x)
{
    if(!(x==null || x.next==null))
        x.next=x.next.next;
 }

猜你喜欢

转载自www.cnblogs.com/longjin2018/p/9849562.html