deleteByNode可以提前结束

当删除节点为头结点的时候可以不用进行循环查找要删除节点的前驱节点
This commit is contained in:
Rain Liu 2018-10-06 23:15:37 +08:00
parent 181f721ad6
commit 04c7c20b68

View File

@ -87,6 +87,7 @@ public class SinglyLinkedList {
if (p == head) {
head = head.next;
return;
}
Node q = head;