Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance 算法的运行时间_Performance_Algorithm_Runtime - Fatal编程技术网

Performance 算法的运行时间

Performance 算法的运行时间,performance,algorithm,runtime,Performance,Algorithm,Runtime,我需要运行一段代码,如图所示: sum = 0; for(i = 0; i < n; i++) for(j = 0; j < i; j++) sum++; sum=0; 对于(i=0;i

我需要运行一段代码,如图所示:

 sum = 0;
 for(i = 0; i < n; i++)
     for(j = 0; j < i; j++)
         sum++;
sum=0;
对于(i=0;i
并找出几个N值的运行时间以及与这些值相关的增长率

现在我使用的是DEV C++(可以使用任何IDE),但我不能找到一个实际显示运行时间的方法。

< P>
  • 应用程序中的时间。例如,使用
    time()
    API:
  • 通过将您的应用程序包装到另一个应用程序中来节省时间,这可以节省运行时的时间。在*nix系统上,有一个名为
    time
    的方便实用程序
  • 使用秒表