b******7 发帖数: 92 | 1 算法思想:可以使用|L|大小的最小堆,同时维护堆的最大值,则range为(heap.top(),
max{heap}),最多迭代n-|L|次,得出最优range。
时间复杂度O(|L|) + O(n*log|L|) 由于|L|最多为128,故为O(n)
此算法前提为:D(c)从小到大排序
code:
typedef pair::iterator,vector::iterator> Itemtype;
struct ItemCompare{
bool operator()(const Itemtype & left, const Itemtype & right)
{
return *(left.first) > * (right.first);
}
};
pair minrange(unordered_map > & D, vector &
L)
{
pair result = make_pair(-1,-1);
v... 阅读全帖 |
|
s******e 发帖数: 1037 | 2 i did not recelived it.
I have to use my driver license number to findit on their website. |
|
a*****n 发帖数: 5158 | 3 还有一个有用的可能好多人不知道
就是当你用endnote直接从webofscience 下在reference时有个url link
点那个link直接进到isiknowledge里面, 在最左边就有一个 "FINDIT@..."
点那个就直接带你找到期刊全文的link (先通过学校lib)
你就可以存pdf了 |
|
d*****o 发帖数: 28 | 4 //Notes: may have bug, just show the ideas
Can not input in Chinese, so write in English -
Q1: code:
for k =3, psedocode: // (O(N^2))
input: A[], S
Arrays.sort(A); // O(NlogN)
for(int i = 0; i < A.length-2; i++) // O(N^2)
{
// set A': A - A[i]
findIt(A[i], S-A[i], A'); // find two element in A -A[i] sum to S -
A[i], O(N)
}
DP solution:
// not exactly the solution, just to decide how many K elements sum to
// a value S
input A[], N, K, S
N- size of the array
K- number of elements... 阅读全帖 |
|
l**********o 发帖数: 260 | 5 新手初到,写了几行,请大家指点
// this is to produce an integer array with one number duplicated
import java.util.*;
import java.io.*;
public class proAnArray{
public static void main(String[] args) throws IOException{
FileWriter fw = new FileWriter("Array.txt");
int N = 30000;
fw.write(N + "\n");
for(int i = 0; i < N; i++){
fw.write(i + " ");
if (i % 10 == 0) fw.write("\n");
}
int j = 400;
fw.write(j + "\n"); ... 阅读全帖 |
|
c********r 发帖数: 286 | 6 随手写了一下第一题,请大牛们指教轻拍:
public static void findit(int[] a)
{
if(a==null || a.length<4)
{
return;
}
int min = a[0];
int minindex = 0;
int mid = a[0];
int midindex = 0;
int max = a[0];
int maxindex = 0;
for(int i=0;i
if(a[i]
{
min = a[i];
minindex = i;
}else if(max>a[i]&&a[i]>min){
max = a[i];
... 阅读全帖 |
|
|
|
S*A 发帖数: 7142 | 9 你这个是在用 python 从新实现 re.findall() 或者 re.finditer()
的功能,这个一行就搞定了,而且 re.findall 是用 C 写的,还快。
LZ 这里还要做替换,所以最好还是用 re.sub, 替换的内容用函数
返回就好了。这样你就可以省去繁琐的维护区间位置,拼接的麻烦。
框架都前面例子都帖了。虽然短,干的活比这个还要多。 |
|
m*****i 发帖数: 29 | 10 Keji Zhao's top 3 hottest paper in 2010 seems unknown to all of you guys.
High-resolution profiling of histone methylations in the human genome
[PDF] from bmskorea.co.kr
FindIt@Towson…, DE Schones, Z Wang, G Wei, I Chepelev, K Zhao - Cell, 2007
- Elsevier
Cited by 1271 |
|
|
S******y 发帖数: 1123 | 12 #a simple Python solution
import re
text = '****_***...***_****'
for m in re.finditer( '_', text ):
print( '_ found', m.start(), m.end() )
######################no warranty #################### |
|