Example #1
0
// Driver program to test above function.
int main()
{
    int stream[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
    int n = sizeof(stream)/sizeof(stream[0]);
    int k = 5;
    selectKItems(stream, n, k);
    return 0;
}
Example #2
0
void generateQueryFile(int n,int k,const char *filename){
	std::vector<int> nodeList;
	nodeList.resize(n);
	for(int i=0;i<n;i++){
		nodeList[i] = i;
	}
	std::vector<int> Query = selectKItems(nodeList,n,k);

	FILE *f = fopen(filename,"w");
	for(int i=0;i<Query.size();i++){
		loadBar(i,n,50,50);
		fprintf(f, "%d ",Query[i]);
	}
	fprintf(f, "-1");
	fclose(f);
	return;
}