码迷,mamicode.com
首页 >  
搜索关键字:median of two sorted    ( 17004个结果
Lists and tuples
zip is a built-in function that takes two or more sequence and ‘zips’ them into a list of tuples, where each tuple contains one element from each sequ...
分类:其他好文   时间:2014-07-22 22:53:14    阅读次数:269
[leetcode]Merge Two Sorted Lists
Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the fir...
分类:其他好文   时间:2014-07-22 22:51:35    阅读次数:146
[leetcode]Swap Nodes in Pairs
Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2-...
分类:其他好文   时间:2014-07-19 22:25:10    阅读次数:210
LeetCode:Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:其他好文   时间:2014-07-19 22:19:36    阅读次数:202
Tuple assignment
It is often useful to swap the values of two variables. With conventional assignments, you have to use a temporary variable. This solution is cumberso...
分类:其他好文   时间:2014-07-19 18:32:06    阅读次数:243
Box Game
There are two identical boxes. One of them contains n balls, while the other box contains one ball. Alice and Bob invented a game with the boxes and b...
分类:其他好文   时间:2014-07-19 14:25:51    阅读次数:228
NYOJ 5 Binary String Matching (kmp 字符串匹配)
Binary String Matching 时间限制:3000 ms  |  内存限制:65535 KB 难度:3 描述 Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as...
分类:其他好文   时间:2014-07-19 13:26:19    阅读次数:274
One-Two-Three
Your little brother has just learnt to write one, two and three, in English. He has written a lot of those words in a paper, your task is to recognize...
分类:其他好文   时间:2014-07-19 11:30:29    阅读次数:225
STL 源码剖析 算法 stl_algo.h -- merge
merge (应用于有序区间) -------------------------------------------------------------------------- 描述:将两个经过排序的集合S1和S2,合并起来置于另一段空间。所得结果也是一个有序(sorted)序列 思路: 1.遍历两个序列直到其中一个结束了 2.如果序列一的元素较小,将它放到结果序列中,并前进 1 3.如果序列二的元素较小,将它放到结果序列中,前前进 1 4.遍历结束后,将还没有遍历完的序列复制到结果序列的尾部 源码:...
分类:其他好文   时间:2014-07-19 08:16:09    阅读次数:212
UVA 10090 Marbles(扩展欧几里得)
Marbles Input: standard input Output: standard output I have some (say, n) marbles (small glass balls) and I am going to buy some boxes to store them. The boxes are of two types: Type 1: each ...
分类:其他好文   时间:2014-07-19 08:01:10    阅读次数:264
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!