1. 原始题目 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, ...
分类:
其他好文 时间:
2019-04-06 12:34:36
阅读次数:
111
栈(stack):先进后出; 队列(queue):先进先出; 数组(Array):有序的元素序列;查询快(数组的地址是连续的),增删慢; 链表(linked list):由一系列结点node(链表中的每一个元素称为结点)组成, 二叉树——红黑树: ...
分类:
其他好文 时间:
2019-04-05 20:18:34
阅读次数:
163
1. 原始题目 Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the seco ...
分类:
其他好文 时间:
2019-04-05 16:54:43
阅读次数:
153
1. 原始题目 Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly link ...
分类:
其他好文 时间:
2019-04-05 12:35:56
阅读次数:
149
1. 原始题目 Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: 2. 题目理解 给定一个排序链表,删除所有重复的元素,使得 ...
分类:
其他好文 时间:
2019-04-05 12:14:40
阅读次数:
140
1. 原始题目 Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Example 2: 2. 题目理解 给定一个链表,旋转链表,将链表每个节点向右移动 ...
分类:
其他好文 时间:
2019-04-04 23:08:26
阅读次数:
252
1. 原始题目 Reverse a singly linked list. Example: 2. 题目理解 反转一个单链表 注意:空链表的处理,单个结点的处理 3. 解法 因为在反向指向结点的时候容易导致链表出现断裂,所以需3个结点保存当前结点,当前结点之前,之后的结点。 4. 验证结果 1 1 ...
分类:
其他好文 时间:
2019-04-04 15:46:51
阅读次数:
132
题目要求 Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL 题目分析及思路 给定一个单链表,要求得到它的逆序。可以使用列表对链表结点进行保存,之后新建一个列表对链 ...
分类:
其他好文 时间:
2019-03-30 10:36:25
阅读次数:
187
题目如下: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balance ...
分类:
其他好文 时间:
2019-03-30 10:34:39
阅读次数:
115