/**
* 单链表节点个数
* @return
*/
public static int demo(Node node) {
int count = 0;
if(node == null) {
return count;
}
while(node != null) {
count++;
node = node.next;
}
return count;
}
网友评论