题目: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 lists. 1 str...
分类:
其他好文 时间:
2015-04-01 10:49:18
阅读次数:
112
题目:
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity
should be O(log (m+n)).
思路:这道题比较直接的想法就是用Merge
Sort...
分类:
其他好文 时间:
2015-04-01 09:33:08
阅读次数:
143
题目: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 lists.
struct ListNode {
int val;
ListNode *next;
ListNo...
分类:
其他好文 时间:
2015-04-01 09:31:07
阅读次数:
131
题目:Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
A: a1 → a2
↘
...
分类:
其他好文 时间:
2015-03-31 22:21:16
阅读次数:
116
合并有序两个链表 class Solution {public: ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { ListNode* res = new ListNode(0); if (l1 == NULL) { return l2; }...
分类:
其他好文 时间:
2015-03-31 21:50:59
阅读次数:
134
首先,明确两个概念:
逆序对:数列a[1],a[2],a[3]…中的任意两个数a[i],a[j] (ia[j],那么我们就说这两个数构成了一个逆序对.
逆序数:一个数列中逆序对的总数.
例题一:POJ 1804. 点击打开链接
解题思路:每次交换只能减少一个逆序,而且必定能减少一个逆序,从而问题就转换为求逆序个数了。这题数据规模很小,暴力可过。
我这里提供了用Merge_sort的方...
分类:
编程语言 时间:
2015-03-31 18:07:05
阅读次数:
142
今天下午做了一道题。leetcode merge intervals 属于比较难的题目。
首先用collections.sort 给list排序,然后用两个while loop来比较两个interval 的start, end 。 从而生成新的interal,再插入到新的list 返回结果。
下面给出自己的代码:
/*
50 Merge Intervals
https://leetcode.com/problems/merge-intervals/
Given a collection o...
分类:
其他好文 时间:
2015-03-31 14:47:07
阅读次数:
130
前台pc标签的使用:{pc:content 参数名="参数值" 参数名="参数值" 参数名="参数值"} 如: {pc:content action="lists" catid="9" cache="3600" num="20" page="$page"}{/pc} 执行流程如下: ①模块名:con...
分类:
Web程序 时间:
2015-03-30 22:31:30
阅读次数:
233
oracle merge into用法2011-08-24 10:52:54|分类:oracle|举报|字号订阅 在平时更新数据时,经常有这样一种更新,即将目标表中的数据与源表对比,如果存在记录,则根据源表中的值更新目标表中的数据,如果不存在的话,则新增入目标表中。我们当然可以使用两条语句来处理这....
分类:
数据库 时间:
2015-03-30 20:33:34
阅读次数:
153
在查看sql执行计划时,我们会发现表的连接方式有多种,本文对表的连接方式进行介绍以便更好看懂执行计划和理解sql执行原理。一、连接方式: 嵌套循环(NestedLoops (NL)) (散列)哈希连接(Hash Join (HJ)) (归并)排序合并连接(Sort Merge Join (SM...
分类:
数据库 时间:
2015-03-30 16:11:36
阅读次数:
146