Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each va ...
分类:
其他好文 时间:
2018-06-11 15:45:08
阅读次数:
166
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, ...
分类:
其他好文 时间:
2018-06-11 13:50:45
阅读次数:
159
问题描述: Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the firs ...
分类:
其他好文 时间:
2018-06-11 11:04:18
阅读次数:
165
问题描述: Sort a linked list in O(n log n) time using constant space complexity. Example 1: Example 2: 解题思路: 说到O(nlogn)那就必然想到快速排序和归并排序和堆排序 参考大佬整理的方法 代码: 归 ...
分类:
其他好文 时间:
2018-06-11 11:01:16
阅读次数:
176
问题描述: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: Examp ...
分类:
其他好文 时间:
2018-06-10 12:11:26
阅读次数:
144
描述Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2.Aer remo ...
分类:
编程语言 时间:
2018-06-09 22:04:32
阅读次数:
170
描述Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then ...
分类:
编程语言 时间:
2018-06-09 20:30:42
阅读次数:
166
import edu.princeton.cs.algs4.*; public class SequentialSearchST { private Node first; private class Node { Key key; Value val; Node next; p... ...
分类:
其他好文 时间:
2018-06-07 21:52:14
阅读次数:
153
问题描述: Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: 解题思路: 这里要求翻转第m个节点到第n个节点的顺序。 我们可以先通过m与n ...
分类:
其他好文 时间:
2018-06-05 13:31:03
阅读次数:
175
```java PriorityQueue queue= new PriorityQueue(lists.length,new Comparator(){ @Override public int compare(ListNode o1,ListNode o2){ if (o1.val ...
分类:
其他好文 时间:
2018-06-04 14:34:36
阅读次数:
109