How to generate large data set inputs for problems?

How to generate large inputs for problems , and with given constraints ??

Thanks!!

1 Like

All credits to @bansal1232

Use rand() function of C++.
Generate random test cases according to the input provided in the question. After that Run your WA program and AC program(code that you are 100% assure of correctness) and compare both the outputs. You can use Microsoft office word or any other tool to determine at which line is not matching in both the output generated files.
If you only wish to generate the test cases, you don’t need the AC solutions to cross-check.

int main()
{
int i,j;

srand (time(NULL));
int t=20;

while(t--)
{
   int k=rand()%10+1;
   for(i = 0 to k)

   printf("%c",rand()%26+97);
   printf("\n%d\n",rand()%k+1);

 }
 return 0;

}

You can use the SPOJ Test Data Generator. That’s the best toolkit to test your code on large inputs.

With this toolkit, you can easily generate large inputs of various data type arrays, strings, random numbers, weighted/unweighted trees or graphs.

5 Likes

You can refer to my answer here.

Also, you can see my test case generators here.

3 Likes