码迷,mamicode.com
首页 >  
搜索关键字:smallest sub-array    ( 590个结果
Leetcode 230 Kth Smallest Element in a BST
Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota...
分类:其他好文   时间:2015-07-02 09:53:05    阅读次数:128
poj3260 The Fewest Coins
Description Farmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a way that the smallest number of coins changes hands, i.e., the...
分类:其他好文   时间:2015-06-30 18:32:13    阅读次数:141
Binary Search Tree Iterator -- leetcode
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-06-26 18:11:51    阅读次数:116
Uva - 11536 - Smallest Sub-Array
类似滑动窗口,不过窗口的最大长度需要依靠其中是否包含1~k来判定,右端点从左到右移动,用vis[i]数组记录i在窗口中出现的次数,如果vis[i] == 1,则说明第一次出现,cnt 就增加1。当cnt 和 k 相等的时候,记录下此时的长度,然后左端点向右移动,如果左边出窗口的值原本刚好只有1个时,就要cnt减小1了。...
分类:其他好文   时间:2015-06-26 16:18:08    阅读次数:88
leetCode(24):Binary Search Tree Iterator
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-06-23 13:38:01    阅读次数:103
面试题:最大的子数组之和,和最大子数组的始末位置
给出一个数组,求出最大子数组的和以及始末位置。 直接给出代码解释:int sub_array(int *array,int n) { int max2 = -INF; int sum = 0; int cur = 0; int count2 = 0; int flag; int _end; /*时间复杂度:o(n) 空间复杂度:o(1) */...
分类:编程语言   时间:2015-06-16 21:16:41    阅读次数:230
谱聚类算法(Spectral Clustering)
谱聚类(Spectral Clustering, SC)是一种基于图论的聚类方法——将带权无向图划分为两个或两个以上的最优子图,使子图内部尽量相似,而子图间距离尽量距离较远,以达到常见的聚类的目的。其中的最优是指最优目标函数不同,可以是割边最小分割——如图1的Smallest cut(如后文的Min...
分类:编程语言   时间:2015-06-16 20:55:28    阅读次数:136
POJ2718 Smallest Difference (暴力搜索+全排列)
POJ2718 Smallest Difference (暴力搜索+全排列)...
分类:其他好文   时间:2015-06-16 11:12:16    阅读次数:143
hdu5269 数据结构Trie
Memphis loves xor very musch.Now he gets an array A.The length of A is n.Now he wants to know the sum of all (lowbit(Ai xor Aj)) (i,j∈[1,n]) We define that lowbit(x)=2k,k is the smallest integer sa...
分类:其他好文   时间:2015-06-14 09:34:19    阅读次数:150
UVA 11997--K Smallest Sums+优先队列用于多路归并
题目链接:点击进入 先考虑两个数组A,B的情况,这样总共有n^2种情况;将A,B数组排序后,我们可以将所有情况组织成n张表: 表1: A[1]+B[1]<=A[1]+B[2]<=……<=A[1]+B[n]. 表2: A[2]+B[1]<=A[2]+B[2]<=…….<=A[2]+B[n]. ……. 表n: A[n]+B[1]<=A[n]+B[2]<=……..<=A[n]+B[n] 这n张...
分类:其他好文   时间:2015-06-13 14:17:31    阅读次数:145
590条   上一页 1 ... 45 46 47 48 49 ... 59 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!