码迷,mamicode.com
首页 >  
搜索关键字:lists    ( 2473个结果
LeetCode | # 23
题目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思路: 解法一:维护一个大小为k的堆,每次去堆顶的最小元素放到结果中,然后读取该元素的下一个元素放入堆中,重新维护好。因为每个链表是有序的,每次又是去当前k个元素中最小的,...
分类:其他好文   时间:2015-03-09 22:32:10    阅读次数:203
LeetCode_Merge Two Sorted Lists
题目链接:https://leetcode.com/problems/merge-two-sorted-lists/ 题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two ...
分类:其他好文   时间:2015-03-09 11:05:29    阅读次数:134
LeetCode_Intersection of Two Linked Lists
题目链接:https://leetcode.com/problems/intersection-of-two-linked-lists/ 题目: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the followi...
分类:其他好文   时间:2015-03-09 11:05:15    阅读次数:145
leetcode------Add Two Numbers
标题:Add Two Numbers通过率:22.6%难度:中等You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each ...
分类:其他好文   时间:2015-03-08 21:19:22    阅读次数:123
Intersection of Two Linked Lists
存在两个单向链表,如果两者在某个节点相交合并,则返回交点,不相交则返回null。 思路:如果两个链表长度相等,则两个指针依次前进,到结尾之前如果遇到val值相等,则返回该节点。如果不相等,则长的那个链表先走若干步,使得剩下的步数与短的链表的步数相同。 注意点 空指针 由于是单链表,需要保存链表头 c...
分类:其他好文   时间:2015-03-08 11:35:39    阅读次数:119
[LeetCode] Add Two Numbers
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 ...
分类:其他好文   时间:2015-03-08 00:02:05    阅读次数:193
Merge Two Sorted Lists
Merge Two Sorted Lists问题:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the ...
分类:其他好文   时间:2015-03-06 18:31:18    阅读次数:123
Nutch+Hadoop集群搭建(转载)
1、Apache NutchApache Nutch是一个用于网络搜索的开源框架,它提供了我们运行自己的搜索引擎所需的全部工具,包括全文搜索和Web爬虫。1.1、Nutch的组件结构WebDB:存储网页数据和连接信息Fetch lists:将WebDB所存储的连接分成多个组,来用于分布式检索Fetc...
分类:其他好文   时间:2015-03-06 15:51:23    阅读次数:143
Intersection of Two Linked Lists
编程之美上有这题,先计算这两链表的长度,然后从这两链表长度相等处扫一遍,找到相同节点就跳出即可。O(n)的时间复杂度 O(1)的空间开销/** * Definition for singly-linked list. * struct ListNode { * int val; * ...
分类:其他好文   时间:2015-03-05 23:39:24    阅读次数:196
Intersection of Two Linked Lists
https://oj.leetcode.com/problems/intersection-of-two-linked-lists/Write a program to find the node at which the intersection of two singly linked list...
分类:其他好文   时间:2015-03-05 20:53:54    阅读次数:141
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!