Answer to Question #84586 in Algorithms for ML.R

Question #84586
Find the time complexity of the following algorithms in terms of Big O.
1) A function (or set of statements) that doesn’t contain loop, recursion and call to any other non-constant time function.
2) A loop or recursion that runs a constant number of times, such as follows:
for (int i = 1; i <= c; i++) // Here c is a constant
{
// some O(1) expressions
}
3) A loop where the loop variables is incremented / decremented by a constant amount, as follows:
// Here c is a positive integer constant
for (int i = 1; i <= n; i += c) {
// some O(1) expressions
}
4) Time complexity of nested loops as follows:
// Here c is a positive integer constant
for (int i = 1; i <=n; i += c) {
for (int j = 1; j <=n; j += c) {
// some O(1) expressions
}
}
//Or the following nested loop
for (int i = n; i > 0; i += c) {
for (int j = i+1; j <=n; j += c) {
// some O(1) expressions
}
1
Expert's answer
2019-01-28T03:01:24-0500
Dear ML.R, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS