public class January_22 {
final private static Random generator = new Random();
public static void main(String[] args) {
int pick1, pick2, pick3,num, count = 0; // Executes 1-time
Scanner scan = new Scanner(System.in); // Executes 1-time
System.out.println("Please enter an integer: "); // Executes 1-
num = scan.nextInt(); // Executes 1 time
pick1 = generator1(num);
pick2 = generator2(num); // 1 TIME
pick3 = generator3(num);
while (pick1 != pick2 || pick1 != pick3 ){ // Times???
pick2 = generator2(num);
pick3 = generator3(num);
count++;
System.out.println("Pick1 "+pick1+" Pick2 "+pick2+" Pick3 "+pick3 + " Count: "+count);
}
我对代码的那部分感到困惑。 复杂度公式是什么样的? f(n)=? 我还如何从此代码中估算Theta?