码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
141.Linked List Cycle 快慢指针
问题描述: Given a linked list, determine if it has a cycle in it. 我的思路: 用一个指针指向链表头部,另一个指针在链表上移动。若两个指针指向地址相等,则存在环。 然后我没过OJ:) 因为循环链表的尾部并不一定链接头部,可能链接任意节点,此时会 ...
分类:其他好文   时间:2018-05-17 11:48:12    阅读次数:123
Java-单链表的实现
/** * establish a single linked list * 创建一个单链表 * @author fred * */ public class SingleLinkedList { private Node head; private E data; private int size... ...
分类:编程语言   时间:2018-05-15 22:39:20    阅读次数:160
[LeetCode] Insertion Sort List
Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the first elem ...
分类:其他好文   时间:2018-05-11 20:47:38    阅读次数:154
[LeetCode] Sort List
Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1->5->3->4-> ...
分类:其他好文   时间:2018-05-11 20:39:26    阅读次数:154
206.Reverse Linked List
题目链接 题目大意:翻转单链表。要求用递归和非递归两种方法。 法一:非递归。直接对原单链表进行循环操作,且不新开辟空间,用头插法即可。代码如下(耗时0ms): 1 public ListNode reverseList(ListNode head) { 2 if(head == null) { 3 ...
分类:其他好文   时间:2018-05-11 12:57:31    阅读次数:101
random指针的单链表深拷贝(LeetCode——Copy List with Random Pointer)
问题: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep ...
分类:其他好文   时间:2018-05-07 13:26:41    阅读次数:113
24. Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. Example: Given 1->2->3->4, you should return the list as 2->1->4->3. Note: You ...
分类:其他好文   时间:2018-05-03 15:29:02    阅读次数:162
1.3.20
question: Write a method delete() that takes an int argument k and deletes the kth element in a linked list, if it exists. answer: ...
分类:其他好文   时间:2018-05-01 20:51:58    阅读次数:166
1.3.19
question: Give a code fragment that removes the last node in a linked list whose first node is first. answer: ...
分类:其他好文   时间:2018-05-01 20:39:50    阅读次数:183
1.3 LINKED-LIST EXERCISES
1.3.18 1.3.19 1.3.20 1.3.21 1.3.22 1.3.23 1.3.24 1.3.25 1.3.26 1.3.27 1.3.28 1.3.29 1.3.30 1.3.31 ...
分类:其他好文   时间:2018-05-01 15:54:56    阅读次数:142
3784条   上一页 1 ... 70 71 72 73 74 ... 379 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!