课堂练习之链表节点删除与构建堆
课堂练习之链表节点删除
Node x = new Node<Integer>();
Node y = new Node<integer>();
x.data = 6;
x.next = y;
y.data = 8;
// 在此处添加7节点
Node z = new Node<Integer>(7,y);
x.next = z;
// 删除7节点
Node curr = x;
Node prev = x;
while(curr.data==7&curr.next!=null){
prev = curr;
curr = curr.next;
}
prev.next = curr.next;