最新 最热

链表之顺序存储

顺序存储优点:1 不用额外增加新的节点空间2 可以快速读取任意位置的元素顺序存储缺点:1 插入和删除需要移动大量元素2 长度变化较大时,难以估计长度3 存储空间碎片化读取时,时间复杂度为O(1);插入或删除时,时间复杂度为O(...

2018-01-18
0

二项队列

二项队列是 堆序 的集合,也叫 森林。其中每一种形式都有约束。二项树Bk由一个带有儿子的B0,B1,B2...组成,高度为k的二项树 恰好有2^k个结点。每一种高度只能出现一次...因此,只有1,2,4,8...等结点数目的二项树deleteMin...

2018-01-17
0

Leetcode 92 Reverse Linked List II

Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->N...

2018-01-12
1

Leetcode 83 Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, ret...

2018-01-12
2

Leetcode 147 Insertion Sort List

Sort a linked list using insertion sort. 对链表插入排序,没啥好说的。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next;...

2018-01-12
1

Leetcode 143 Reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For exam...

2018-01-12
1

Leetcode 206 Reverse Linked List

Reverse a singly linked list. 链表逆置,之前好像做过类似的Leetcode题目了。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next;...

2018-01-12
0

Leetcode 203 Remove Linked List Elements

Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 --> 3 ...

2018-01-12
0

Leetcode 234. Palindrome Linked List

Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) ti

2018-01-12
1

LeetCode: 2_Add Two Numbers | 两个链表中的元素相加 | Medium

题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit....

2018-01-11
0