先建好测试环境:
USE TEMPDB
GO
IF OBJECT_ID('T1') IS NOT NULL DROP TABLE T1
IF OBJECT_ID('T2') IS NOT NULL DROP TABLE T2
GO
CREATE TABLE T1(ID1 INT,VAL1 VARCHAR(50))
CREATE TABLE T2(ID2 INT,VAL2 VARCHAR(5...
分类:
其他好文 时间:
2014-08-27 14:50:37
阅读次数:
197
Median of Two Sorted Arrays
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 (...
分类:
其他好文 时间:
2014-08-27 14:47:18
阅读次数:
148
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in t...
分类:
其他好文 时间:
2014-08-27 13:05:17
阅读次数:
226
一、归并排序
算法思路就是把数组分成左右两个部分,然后再进行归并两个有序表
void merge(int* num,int start,int mid,int end,int* copy)
{
int i = start,m = mid,j = mid+1,n = end,k=start;
while(i <= m && j <= n)
{
if(num[i] < num[j])co...
分类:
其他好文 时间:
2014-08-27 13:04:57
阅读次数:
247
合并是一维数据结构中很常见的操作, 通常是排序, 分布式算法中的子操作。 这篇总结主要介绍LeetCode中关于合并的几个题目: Merge Two Sorted ListsMerge Sorted ArraySort ListMerge k Sorted Lists我们先来看看两个有序一维数据的合并, 这里主要是要介绍链表的合并操作, 不过因为一维数组的合并也比较简单, 而且与链表有比较性, 就...
分类:
其他好文 时间:
2014-08-27 12:59:07
阅读次数:
348
字典的排序:按键排序sorted(dic.iteritems(),key=lambdadic:dic[0],reverse=False)按值排序sorted(dic.iteritems(),key=lambdadic:dic[1],reverse=False)如果在继承关系中,父类中的字段是__fi...
分类:
编程语言 时间:
2014-08-27 08:10:37
阅读次数:
276
SQLServer 2008中SQL增强之三 Merge(在一条语句中使用Insert,Update,Delete)SQL Server 2008提供了一个增强的SQL命令Merge,用法参看MSDN:http://msdn.microsoft.com/zh-cn/library/bb510625....
分类:
数据库 时间:
2014-08-26 22:49:36
阅读次数:
330
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initial...
分类:
其他好文 时间:
2014-08-26 21:18:36
阅读次数:
204
Sorting It All Out
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 27929
Accepted: 9655
Description
An ascending sorted sequence of distinct values is on...
分类:
其他好文 时间:
2014-08-26 19:40:46
阅读次数:
194
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the...
分类:
其他好文 时间:
2014-08-26 17:19:16
阅读次数:
191