链表(Linked List)介绍 链表是有序的列表,但是它在内存中是存储如下 1)链表是以节点方式存储的,是链式存储 2)每个节点包含data域(value),next域,指向下一个节点 3)各个节点不一定连续存储,如上图 4)链表分 带头节点的链表和 不带头节点的链表,根据实际需求确定 单链表介 ...
分类:
其他好文 时间:
2019-06-02 01:01:38
阅读次数:
95
leetcode algorithms 92. Reverse Linked List II Reverse a linked list from position m to n. Do it in one pass. Note: 1 ≤ m ≤ n ≤ length of list. Exampl ...
分类:
其他好文 时间:
2019-06-01 23:17:25
阅读次数:
127
Q: 在扫整个链表的时候,到底什么时候用 while(cur!=null) 什么时候用 while(cur.next!=null) 呢? 以[leetcode]83. Remove Duplicates from Sorted List有序链表去重(有重去重)和[leetcode]82. Remov ...
分类:
其他好文 时间:
2019-06-01 09:26:17
阅读次数:
177
Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: Follow up:Could you do it in O(n) time and O(1) space? (1)定义快慢指针得到链 ...
分类:
其他好文 时间:
2019-05-31 19:59:07
阅读次数:
113
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, we use ...
分类:
其他好文 时间:
2019-05-31 19:23:13
阅读次数:
102
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. Given a linked list and ...
分类:
其他好文 时间:
2019-05-23 21:17:24
阅读次数:
102
LeetCode地址:https://leetcode-cn.com/problems/delete-node-in-a-linked-list/ 描述: 请编写一个函数,使其可以删除某个链表中给定的(非末尾)节点,你将只被给定要求被删除的节点。 现有一个链表 -- head = [4,5,1,9] ...
分类:
其他好文 时间:
2019-05-23 16:59:20
阅读次数:
111
description: 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 tha ...
分类:
其他好文 时间:
2019-05-19 11:39:00
阅读次数:
82
原文地址:https://www.jianshu.com/p/831f8ab83843 时间限制:1秒 空间限制:32768K 题目描述 Given a singly linked list L : L 0→ L 1→…→ L n 1→ L n, reorder it to: L 0→ L n → ...
分类:
其他好文 时间:
2019-05-10 15:07:04
阅读次数:
77
原文地址:https://www.jianshu.com/p/77ec745fca5c 时间限制:1秒 空间限制:32768K 题目描述 Given a linked list, determine if it has a cycle in it. Follow up: Can you solve ...
分类:
其他好文 时间:
2019-05-10 14:51:08
阅读次数:
163