如何根据R中的变量绘制运行时间?

时间:2017-03-19 00:37:49

标签: r plot runtime norm

我在R中有以下功能:

enter code here import java.io.File;
import java.util.Scanner;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class projectFour
{
public static int [] global_numbers;


public static void main (String[] args)
{
  read_file();
  print_numbers(global_numbers);

}



public static void read_file()
{
try
      {
        File file = new File("randomNumbers.txt"); 
        Scanner scan = new Scanner(file);
        int maxNumberInFile = convertingStringToInt(scan.nextLine()); // read the first line which is 100 to set array size
        global_numbers = new int[maxNumberInFile]; // set the array size equal to the first line read which is 100
        int i = 0; 

             while(scan.hasNextLine()) // while there is a next line to read, do this...
              {
                 String line = scan.nextLine();
                 global_numbers [i] = convertingStringToInt(line); 
                 i++; 
              }
                 scan.close();        
      }

  catch(IOException ex)
        {
           ex.printStackTrace();
        }    

}

public static int convertingStringToInt(String number)
{  
try
     {
        return Integer.parseInt(number);
     }

  catch(NumberFormatException n)
     {
           return -460;
     }         
}

public static void print_numbers(int [] numbers)
{
  int max = numbers.length;
  for(int i = 0; i < max; i++)
     {
        System.out.println(numbers[i]); 
     }
}
}

我希望绘制三种方法的运行时,因为n增加到足够大的值,以便运行时模式变得稳定。

0 个答案:

没有答案