码迷,mamicode.com
首页 >  
搜索关键字:kth    ( 692个结果
Kth Largest Element in an Array -- leetcode
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For example, Given [3,2,1,5,6,4] and k = 2, return 5. ...
分类:其他好文   时间:2015-08-20 18:58:12    阅读次数:157
Leetcode 之 Median of Two Sorted Arrays
C语言版double find_kth(int* nums1, int nums1Size, int* nums2, int nums2Size, int k, int c) { if (0 == nums1Size) { if (0 == c) return nums2[k -...
分类:其他好文   时间:2015-08-19 22:56:13    阅读次数:108
hdoj 4006 The kth great number
The kth great number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 8622    Accepted Submission(s): 3399 Problem Description Xiao ...
分类:其他好文   时间:2015-08-18 16:19:29    阅读次数:174
SPOJ-QTREE2 Query on a tree II(暴力+LCA)
题目大意:给出一棵树,3种操作 DIST u,v 询问u到v的距离 KTH k, u, v 询问u到v的路径上的第k大的边的权值解题思路:刚开始以为会爆,结果发现不会 直接暴力存储u到v的路上的所有边,再进行排序,输出第k大的边即可#include #include #define N 10010struct Edge{ int to, next...
分类:其他好文   时间:2015-08-18 01:15:27    阅读次数:117
hdu 2665 Kth number(划分树)
题意:给定一列数,每次查询区间[s,t]中的第k大;参考:http://www.cnblogs.com/kane0526/archive/2013/04/20/3033212.html http://www.cnblogs.com/kuangbin/archive/2012/08/14/2638.....
分类:其他好文   时间:2015-08-16 07:03:07    阅读次数:171
LeetCode:Pascal‘s Triangle II - 帕斯卡三角形2
1、题目名称 Pascal‘s Triangle II(帕斯卡三角形2) 2、题目地址 https://leetcode.com/problems/pascals-triangle-ii/ 3、题目内容 英文:Given an index k, return the kth row of the Pascal‘s triangle. 中文...
分类:其他好文   时间:2015-08-15 16:45:00    阅读次数:155
[LeetCode] 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-08-14 16:58:03    阅读次数:98
[LeetCode] Kth Largest Element in an Array
Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For exampl...
分类:其他好文   时间:2015-08-13 11:23:41    阅读次数:108
【LeetCode-面试算法经典-Java实现】【119-Pascal's Triangle II(帕斯卡三角形(杨辉三角)II)】
【119-Pascal’s Triangle II(帕斯卡三角形II)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题  Given an index k, return the kth row of the Pascal’s triangle.   For example, given k = 3,   Return [1,3,3,1].   Note:   Co...
分类:编程语言   时间:2015-08-13 07:48:37    阅读次数:176
[Leetcode] Kth largest element in an array
这个题目使用快排。这里涉及如何实现快排的问题。在[1]当中有一个快排的实现例子。在这里我们关注与快排的实现而不是这个问题本身,因为快排的问题解决了,这个问题就解决了快排的思想是选择一个元素,从两边进行遍历将遇到的第一对不满足序列关系的元素进行交换。关键是这里如何实现这种兑换1、可以在同时找到这两个元...
分类:其他好文   时间:2015-08-11 20:53:54    阅读次数:83
692条   上一页 1 ... 51 52 53 54 55 ... 70 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!