Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to ...
分类:
其他好文 时间:
2019-01-14 20:21:04
阅读次数:
124
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 ...
分类:
其他好文 时间:
2019-01-13 15:00:12
阅读次数:
212
Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts". The length of each ...
分类:
其他好文 时间:
2019-01-12 21:00:12
阅读次数:
121
一、list介绍: List由双向链表(doubly linked list)实现而成,元素也存放在堆中,每个元素都是放在一块内存中,他的内存空间可以是不连续的,通过指针来进行数据的访问,这个特点使得它的随机存取变得非常没有效率,因此它没有提供[]操作符的重载。但是由于链表的特点,它可以很有效率的支 ...
分类:
编程语言 时间:
2019-01-12 18:59:52
阅读次数:
168
/ Definition for singly linked list. public class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } / class Solution { public ListNode ...
分类:
其他好文 时间:
2019-01-10 18:23:27
阅读次数:
97
Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the first elem ...
分类:
其他好文 时间:
2019-01-09 17:29:49
阅读次数:
169
Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removi ...
分类:
其他好文 时间:
2019-01-08 15:02:37
阅读次数:
118
题目的大意为找寻LinkedList的中间节点,如果有两个中间节点,返回第二个中间节点。 比如: 或者: 拿到这道题,我首先想到先获取链表长度,再取中间值,去查询节点。 代码实现为: java public ListNode middleNode(ListNode head) { int lengt ...
分类:
其他好文 时间:
2019-01-06 10:42:53
阅读次数:
166
python中的链表(linked list)是一组数据项的集合,其中每个数据项都是一个节点的一部分,每个节点还包含指向下一个节点的链接。链表的数据结构如下图所示 在链表中删除操作可以通过修改指针来实现,如下图所示: 插入则是调整,插入点的前后两个指针的指向关系,如下图所示: 在python中每个变 ...
分类:
编程语言 时间:
2019-01-02 13:35:28
阅读次数:
220
/** * Lock by Leetcode * 369. Plus One Linked List * https://www.lintcode.com/problem/plus-one-linked-list/description * * Given a non-negative intege ...
分类:
其他好文 时间:
2019-01-01 12:27:05
阅读次数:
240