Given two sorted arrays A, B of size m and n respectively. Find the k-th smallest element in the union of A and B. You can assume that there are no du...
分类:
其他好文 时间:
2015-01-11 22:48:15
阅读次数:
187
#include
#include
#include
#include
#include "oj.h"
using namespace std;
bool comp(int iElem1, int iElem2)
{
string str1;
char ch1[100];
memset(ch1, 0, sizeof(char) * 100);
itoa(iElem1, ch1, ...
分类:
其他好文 时间:
2015-01-10 15:17:15
阅读次数:
153
这是本人在研究leetcode中Median of Two Sorted Arrays一题目的时候看到一篇文章,觉得非常好,其中对快速排序重新实现。
文章来源于http://www.geeksforgeeks.org/这个网站。
We recommend to read following post as a prerequisite of this post.
K’th Sma...
分类:
其他好文 时间:
2015-01-09 10:45:54
阅读次数:
189
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next()...
分类:
其他好文 时间:
2015-01-06 20:09:24
阅读次数:
159
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next()...
分类:
其他好文 时间:
2015-01-03 22:26:17
阅读次数:
219
【题目】
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
No...
分类:
其他好文 时间:
2015-01-03 12:00:06
阅读次数:
161
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next()...
分类:
其他好文 时间:
2015-01-01 00:17:15
阅读次数:
221
Given an array of integers, find the subarray with smallest sum.Return the sum of the subarray.NoteThe subarray should contain at least one integer.Ex...
分类:
其他好文 时间:
2015-01-01 00:08:45
阅读次数:
135
题目大意:有k个数组,每个数组选取一个数,组成k^k个数。在这k^k个数中选择最小的前k个数解题思路:1、如果只有k个数组,那么最后得到的最小的前k个数应该可以由前两个数组得到的最小k个数与第三个数组按规则运算后得到。2、如果每个数组只有3个数.那么前两个数组(a:(a0,a1,a2) b:(b0,b1,b2,a与b数组都已经有序)运算后有的结果矩阵如下:a0+b0,a0+b1,a0+b2a...
分类:
编程语言 时间:
2014-12-30 20:44:38
阅读次数:
250
Minimum Subarray原题链接: http://lintcode.com/zh-cn/problem/minimum-subarray/#Given an array of integers, find the subarray with smallest sum.Return the s...
分类:
其他好文 时间:
2014-12-19 19:05:04
阅读次数:
250