Which one will be faster?
a.For(int i = 0; i < 1000; i++) {}
b.For(int i = 1000; i > 0; i–) {}?
Answers
Answered by
0
Hey mate 2nd one is correct.
Answered by
1
Time of execution for both would be the same which O(n). Here n is the no. Of steps it will run.
So here n is same for both which is 1000.
Thanks
So here n is same for both which is 1000.
Thanks
Similar questions
Hindi,
7 months ago
Science,
7 months ago
English,
7 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Biology,
1 year ago