Write code to remove duplicates from an unsorted linked list.
分类:
其他好文 时间:
2014-07-08 22:18:56
阅读次数:
219
Implement an algorithm to delete a node in the middle of a single linked list, given only access to that node.
分类:
其他好文 时间:
2014-07-08 22:03:31
阅读次数:
195
Implement an algorithm to find the kth to last element of a singly linked list.
分类:
其他好文 时间:
2014-07-08 22:01:38
阅读次数:
209
Implement an algorithm to delete a node in the middle of a singly linked list, given only access to that node.EXAMPLEInput: the node c from the linked...
分类:
其他好文 时间:
2014-07-08 21:58:08
阅读次数:
273
题目
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
解答
首先要注意空链表不成环;不能开额外的空间,即空间复杂度是o(1),可采用“快慢指针”查检查链表是否含有环,如果在快的指针能够追上慢的指针,则有环,否...
分类:
其他好文 时间:
2014-07-08 19:17:47
阅读次数:
160
Given a circular linked list, implement an algorithm which returns node at the beginning of the loop.DEFINITIONCircular linked list: A (corrupt) linke...
分类:
其他好文 时间:
2014-07-08 17:29:35
阅读次数:
200
题目
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant spac...
分类:
其他好文 时间:
2014-07-08 13:46:26
阅读次数:
205
Write code to remove duplicates from an unsorted linked list.FOLLOW UPHow would you solve this problem if a temporary buffer is not allowed?/* Use a H...
分类:
其他好文 时间:
2014-07-08 00:59:05
阅读次数:
305
Sort a linked list using insertion sort.
分类:
其他好文 时间:
2014-07-08 00:41:08
阅读次数:
228
Implement an algorithm to find the kth to last element of a singly linked list.Classical "Runner" Technique of linkedlist/*Use two pointers, forward o...
分类:
其他好文 时间:
2014-07-08 00:37:17
阅读次数:
315