码迷,mamicode.com
首页 >  
搜索关键字:merge two sorted lis    ( 37279个结果
Edit Distance
Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol...
分类:其他好文   时间:2014-05-10 01:09:28    阅读次数:325
Leetcode | Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t...
分类:其他好文   时间:2014-05-09 19:09:35    阅读次数:318
关于 List add方法
add是将传入的参数作为当前List中的一个Item存储,即使你传入一个List也只会另当前的List增加1个元素addAll是传入一个List,将此List中的所有元素加入到当前List中,也就是当前List会增加的元素个数为传入的List的大小eg:result.addAll(list);//把...
分类:其他好文   时间:2014-05-09 18:18:10    阅读次数:275
What is a heap?--reference
A heap is a partially sorted binary tree. Although a heap is not completely in order, it conforms to a sorting principle: every node has a value less ...
分类:其他好文   时间:2014-05-09 17:34:18    阅读次数:339
Leetcode | Insert Interval
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-05-09 16:29:17    阅读次数:330
LeetCode OJ - Convert Sorted Array/List to Binary Search Tree
Array和List的区别在于前者可以随机访问,而后者只能顺序访问。对于把排好序的array转成BST,可以用top-down的方式,很直观也很自然,时间复杂度是O(n)。而对于List如果采用同样的方式,每次需要顺序遍历到中间节点,时间复杂度变成O(nlogn),如果换一种思路,down-top,...
分类:其他好文   时间:2014-05-05 09:34:29    阅读次数:454
归并排序(分治)
1 #include 2 #include 3 4 void MerageSort(int *A, int low, int high); 5 void Merge(int *A, int low, int middle, int high); 6 7 int main() 8 { ...
分类:其他好文   时间:2014-05-04 20:44:56    阅读次数:417
Oracle MERGE INTO的用法
很多时候我们会出现如下情境,如果一条数据在表中已经存在,对其做update,如果不存在,将新的数据插入.如果不使用Oracle提供的merge语法的话,可能先要上数据库select查询一下看是否存在,然后决定怎么操作,这样的话需要写更多的代码,同时性能也不好,要来回数据库两次.使用merge的话则可以一条SQL语句完成. 1)主要功能  提供有条件地更新和插入数据到数据库表中  如果该行存在...
分类:数据库   时间:2014-05-04 18:48:52    阅读次数:527
Codeforces Round #243 (Div. 1)——Sereja and Two Sequences
给两个长度分别为n和m的序列,现在有两种操作:1.分别选择两个序列的一个非空前缀,切两个前缀的最后一位相同,删除之,得到1分(只累计),消耗e;2.直接删除两个序列,消耗值定于两个序列之前删除的元素个数之和,并且使得得到的分有效(之前没有有效分)...
分类:其他好文   时间:2014-05-04 18:10:51    阅读次数:287
uva 10635 Prince and Princess(LCS问题转化成LIS问题O(nlogn))
最长公共子序列经典问题,由于题的条件特殊,可转换成LIS问题,可在O(nlogn)内得到解决。根据刘汝佳大大的,加上自己的理解,不太理解的童鞋可以看一看(前提:已掌握LIS问题和LCS问题的解法)...
分类:其他好文   时间:2014-05-04 08:46:48    阅读次数:339
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!