Insert a node in a sorted linked list. Insert a node in a sorted linked list. Insert a node in a sorted linked list. Example Given list = 1->4->6->8 a ...
分类:
其他好文 时间:
2018-02-03 16:03:35
阅读次数:
149
Similar Questions Reverse Linked List II Binary Tree Upside Down Palindrome Linked List 思路:链表反转。 解法一:迭代。 解法二:递归。 Next challenges: Reverse Linked List ...
分类:
其他好文 时间:
2018-02-02 22:06:07
阅读次数:
230
Reverse a singly linked list. ...
分类:
其他好文 时间:
2018-01-31 14:34:37
阅读次数:
94
单链表 链表是表ADT的一种链式映像。单链表是链表的一种,即每个结点只有一个指针域,指向和它相连的下一个结点。 (这里的链表是带有头结点的链表) 单链表的结点的声明与定义如下: 单链表上的一些操作: (其它可自定义) + int IsEmpty(List L); + int IsLast(List ...
分类:
其他好文 时间:
2018-01-29 20:15:17
阅读次数:
149
Swap Nodes in Pairs 题解 原创文章,拒绝转载 题目来源:https://leetcode.com/problems/swap nodes in pairs/description/ Description Given a linked list, swap every two a ...
分类:
其他好文 时间:
2018-01-27 17:13:57
阅读次数:
119
/* 先序遍历构建链表,重新构建树 */ LinkedList list = new LinkedList(); public void flatten(TreeNode root) { preOrder(root); TreeNode res = root; list.poll(); while ... ...
分类:
其他好文 时间:
2018-01-24 14:03:05
阅读次数:
173
Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.Follow up: Wha... ...
分类:
其他好文 时间:
2018-01-23 23:26:46
阅读次数:
387
A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key ...
分类:
其他好文 时间:
2018-01-23 10:56:43
阅读次数:
135
key point no special data structure, only operation trick listed as below. create a new node as a vritual head which will convinient for the operation ...
分类:
其他好文 时间:
2018-01-20 16:23:40
阅读次数:
150
Sort a linked list in O(n log n) time using constant space complexity. 题目要求给定时间复杂度对链表进行排序,但是我个人认为题目要求不是很合理,使用归并排序时间复杂度满足要求,但是空间复杂度并不为常数,所以个人认为这道题不严谨,说 ...
分类:
其他好文 时间:
2018-01-20 14:05:28
阅读次数:
165