Example #1
0
int main()
{
	typedef std::vector<int>::iterator iter;
	std::cout << "~~~~~~~~~ Testing: " << "Merge sort" << "~~~~~~~~~~~~~~~~~\n";
	test_sorts(merge_sort<iter>);
	return 0;
} 
Example #2
0
int main(int argc, char **argv)
{
   printf("Running ITAlgoritms>>>>>>>>>>>\n");

#if 0
   test_sorts();
#endif

   testBSTree();
   
   printf("foo size =%lu\n", sizeof(foo_));
   return 1;
}
Example #3
0
int
main (int argc, char *argv[])
{
	srand (time (nullptr));

	std::ofstream data ("sorttest.dat");
	for (unsigned i = 12; i <= 24; i++)
		test_sorts (data, i);

	if (!data)
	{
		std::cerr << "Couldn't write statistic data to file" << std::endl;
		return 1;
	}

	FILE *gp = popen ("gnuplot -persist", "w");
	fprintf (gp,
		"set log y\n"
		"set termoption enhanced\n"
		"set style data linespoints\n"
		"set title 'Sorting algorithm comparison'\n"
		"set xlabel 'Array size [2^x]'\n"
		"set ylabel 'Time [ms]'\n"
		"set key top left\n"
		"plot ");

	int i = 0;
	for (auto &test : g_tests)
	{
		if (i)  fprintf (gp, ", ");
		fprintf (gp, "'sorttest.dat' using 1:%d title '%s'",
			i++ + 2, test.name);
	}
	fputc ('\n', gp);

	pclose (gp);
	return 0;
}