summary()sapply(x,fun,options):对数据框或矩阵中的每一个向量进行统计meansd:标准差var:方差min:max:median:length:range:quantile:vars <- c("mpg", "hp", "wt")head(mtcars[vars])su...
分类:
编程语言 时间:
2015-11-27 21:53:15
阅读次数:
247
血的教训:1. 尽信题解,不如无题解!2. C++ STL很坑爹。。测试结果分析与比较:#1是我自己写的,使用priority_queue,超内存:#include #include #include #include using namespace std;priority_queue pq;i....
分类:
其他好文 时间:
2015-11-26 12:33:32
阅读次数:
360
Same as LintCode "Sliding Window Median", but requires more care on details - no trailing zeroes.#include #include #include #include #include #include...
分类:
其他好文 时间:
2015-11-21 15:49:50
阅读次数:
153
题目链接:https://leetcode.com/problems/find-median-from-data-stream/题目描述: 设计一个类,包含两种操作void addNum(int num) - Add a integer number from the data stream to ...
分类:
其他好文 时间:
2015-11-20 15:22:14
阅读次数:
155
Given an array of n integer, and a moving window(size k), move the window at each iteration from the start of the array, find the median of the elemen...
二分中间值x,x和大于等于x的值的数量cnt具有单调性,随着x增大,满足cntx #include#include#include#include#include#include#include#include#include#include#include#includeusing namespa...
分类:
其他好文 时间:
2015-11-19 14:49:48
阅读次数:
93
题意: 给两个有序(升or降)的数组,求两个数组合并之后的中位数。思路: 按照找第k大的思想,很巧妙。将问题的规模降低,对于每个子问题,k的规模至少减半。考虑其中一个子问题,在两个有序数组中找第k大,我们的目的只是将k的规模减半而已,所以可以对比nums1[k/2]和nums2[k/2]的大小,.....
分类:
其他好文 时间:
2015-11-16 14:04:52
阅读次数:
141
# @link http://www.cnblogs.com/zuoyuan/p/3759682.htmlclass Solution(object): def findMedianSortedArrays(self, nums1, nums2): """ :typ...
分类:
编程语言 时间:
2015-11-08 14:24:30
阅读次数:
213
题目链接:https://leetcode.com/problems/median-of-two-sorted-arrays/
题目:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall ru...
分类:
其他好文 时间:
2015-11-06 09:46:52
阅读次数:
234
题目链接:https://leetcode.com/problems/median-of-two-sorted-arrays/题目:There are two sorted arraysnums1andnums2of size m and n respectively. Find the media...
分类:
其他好文 时间:
2015-11-04 20:59:15
阅读次数:
185