2019-10-30 14:00:09
很久前我们已经学习了ArrayList和HashMap的源码,有兴趣的同学请移步:深入剖析ArrayList源码深入剖析HashMap源码今天我们来谈谈LinkedList源码。
阅读全文
2019-08-19 16:00:08
见上图,每个节点可分为两部分:1. 节点的值;2. 下一个节点的指向,即下一个节点是谁。例如:上图链表中的第一个节点,它的值是milk,它的下一个节点是值为Bread的节点。
阅读全文
2019-08-10 16:00:06
LinkedList是一个以双向链表实现的List,它除了作为List使用,还可以作为队列或者栈来使用,它是怎么实现的呢?让我们一起来学习吧。
阅读全文
2019-07-04 09:00:06
前不久帮同事一起 review 一个 job 执行缓慢的问题时发现不少朋友在撸码实现功能时还是有需要细节不够注意,于是便有了这篇文章。
阅读全文
2019-05-18 08:00:44
链表形式跟非链表形式的最大区别在于我们无法根据下标来访问对应下标的元素。假如我们希望从后往前对每个位置求和,则必须每次都从前往后访问到对应下标的值才可以。因此这里通过先将链表转置,再从左往右对每一...
阅读全文
2019-04-29 12:00:41
1 LinkedList 是一个 Doubly-linked list双向连表,实现了Deque接口,该接口中定义了双向连表的一般操作。 2 LinkedList 也实现了List接口,所以List包含的基本方法(新增,删除,插入等)LinkedList都实现了。 3...
阅读全文
2019-01-14 15:00:54
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
阅读全文
2018-12-31 16:00:15
Given a non-empty, singly linked list with head node head, return a middle node of linked list.
阅读全文
2018-12-30 18:00:25
Given a linked list, rotate the list to the right by k places, where k is non-negative.
阅读全文