问题:删除距离末尾n个距离的结点分析:先找出距离末尾n个距离的结点其距离开始的距离多少,然后再删除/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ...
分类:
其他好文 时间:
2014-08-06 21:58:02
阅读次数:
199
Copy List with Random PointerA linked list is given such that each node contains an additional random pointer which could point to any node in the lis...
分类:
其他好文 时间:
2014-08-06 17:44:31
阅读次数:
225
Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re...
分类:
其他好文 时间:
2014-08-06 14:35:41
阅读次数:
177
常用数据结构及复杂度常用数据结构的时间复杂度Data StructureAddFindDeleteGetByIndexArray (T[])O(n)O(n)O(n)O(1)Linked list (LinkedList)O(1)O(n)O(n)O(n)Resizable array list (Li...
分类:
其他好文 时间:
2014-08-05 00:07:58
阅读次数:
391
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.方法:为了使BST高度平衡,要找链表中的中值作为当前根节点。/** * Defin...
分类:
其他好文 时间:
2014-08-04 20:37:47
阅读次数:
194
Given a binary tree, flatten it to a linked list in-place.For example, Given 1 / \ 2 5 / \ \ 3 4 6The flattened ...
分类:
其他好文 时间:
2014-08-04 16:59:37
阅读次数:
246
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
You should preserve the original relative order of the nodes in each of...
分类:
其他好文 时间:
2014-08-03 23:28:56
阅读次数:
261
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?题意:...
分类:
其他好文 时间:
2014-08-02 20:52:54
阅读次数:
246
问题描述:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->...
分类:
其他好文 时间:
2014-08-02 01:33:12
阅读次数:
249
Linked List Cycle
Total Accepted: 24397 Total
Submissions: 68598My Submissions
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra sp...
分类:
其他好文 时间:
2014-08-01 19:52:42
阅读次数:
221