求单链表中有效节点的个数(如果有头结点,不统计头结点)
public static int getLenth(Node head){ if (head.next == null) { return 0; } int lenth = 0; //让辅助指针指向头结点的下一个,就没有统计头结点 Node temp = head.next; while(temp != null){ temp = temp.next; lenth++; } return lenth; }
帖子还没人回复快来抢沙发
常见算法总结 - 链表篇
多线程中sleep()和wait()方法的区别
使用js实现数组的冒泡排序
北京有一条1公里长的街道,你认为一天能收多少钱的停车费?
ArrayList和LinkedList的区别,以及各自是怎么实现扩容的?
帖子还没人回复快来抢沙发