-2

what is the time complexity of this program? I understand that time complexity has something to do with the processor. here is the program

public static void main(String[] args) {
    System.out.println("Heelo, world!");

}

please give me time complexity of this program in java vs c++ vs c#

Sorry if noob question.

1 Answers1

1

What is the time complexity of this program?

The complexity is O(1) ... because there is no scaling variable.

I understand that time complexity has something to do with the processor.

Actually, it has almost nothing to do with "the processor".

However, explaining what Big O complexity (and similar) are really about is too large a task for StackOverflow answer. Instead, I suggest you read the following Wikipedia pages:

Or find a good textbook on algorithms.

please give me time complexity of this program in java vs c++ vs c#

That is nonsensical. The code is Java!

But an equivalent program in C++ or C# will also be O(1) ... for the same reason.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216