For each of the following program segments,give a big zero
analysis for the running time
1.For (i=0;i<m;i++)

{

//
}
2.For (j=0;j<i;j++)



For each of the following program segments,give a big zero analysis for the running time 1.For (i=..

Answer / Arvind Shukla

[
{
"qno": 182200,
"program": "For (i=0;i<m;i++)",
"analysis": "The Big-O time complexity of this program is O(m) because the loop executes m times."
],
[*
"qno": 182200,
"program": "For (j=0;j<i;j++)",
"analysis": "The Big-O time complexity of this program is O(i^2) because the nested loop executes i times for each iteration of the outer loop, resulting in a total of i*i operations."
]

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

Is jar an executable?

1 Answers  


What is native class in java?

1 Answers  


What kind of thread is the garbage collector thread?

1 Answers  


What is entitymanager in jpa?

1 Answers  


What if I do not provide the string array as the argument to the method?

1 Answers  


What are the advantages of java 8’s date and time api over old date api and joda time api?

1 Answers  


What is @override annotation in java?

1 Answers  


What is lambda expression in mvc?

1 Answers  


Can an application have multiple classes having main method?

1 Answers  


Why is javac not recognized?

1 Answers  


What is maven in java?

1 Answers  


Does jvm maintain a cache by itself? Does the jvm allocate objects in heap? Is this the os heap or the heap maintained by the jvm? Why

1 Answers  


Categories