Algorithm Analysis - Growth of Functions

In summary, the conversation discusses two questions. For Question 1, the proposed solution is to increment k by 1 in each iteration, while keeping j always equal to 0 and i always equal to 0. It is uncertain if this is the desired answer. For Question 2, it is determined that (a) is not a valid answer because the un-vertically-translated g could potentially be less than f. It is also concluded that the answer to (b) is yes, as if f is O(g), then g must also be Ω(f). However, it is unclear how to prove this as requested in the question.
  • #1
emeraldskye177
26
0
The problem statements, all variables and given/known data:

Question 1

upload_2017-3-22_3-1-31.png


Question 2
upload_2017-3-22_3-2-57.png


Relevant equations:
Provided in question snips.

The attempt at a solution:


Question 1: I think qux is the answer because it properly increments k by 1 in each iteration. j = j * 2 means j is always 0 so its loop never exits, and i = i++ doesn't actually increment i (as far as I know it should be i = ++i or just ++i or just i++) so i is always 0 and its loop never exits. But I'm not sure if this is the kind of answer they're looking for...

Question 2: I think (a) is no because, though c1 * g > f, the actual un-vertically-translated g could be less than f? Meaning its lower bound c2 * h < f, meaning h < f since c2 > 0. Am I correct on this?

(b) I think the answer is yes. Am I correct in saying, if f is O(g), then g is necessarily Ω(f)? But I'm not sure how to prove it as requested in the question...
 
Physics news on Phys.org
  • #2
bump..
 

What is algorithm analysis?

Algorithm analysis is the process of evaluating the efficiency and performance of an algorithm. It involves studying the time and space complexity of an algorithm as the input size grows.

Why is algorithm analysis important?

Algorithm analysis is important because it allows us to compare and choose the most efficient algorithm for a given problem. It also helps in identifying bottlenecks and improving the performance of existing algorithms.

What is the Big O notation?

The Big O notation is a mathematical notation used to describe the time complexity of an algorithm. It represents the worst-case scenario for the time taken by an algorithm to run as the input size increases.

What is the difference between time and space complexity?

Time complexity refers to the amount of time an algorithm takes to run as the input size increases. Space complexity, on the other hand, refers to the amount of memory an algorithm requires to run as the input size increases.

What are the common types of time complexity?

The common types of time complexity are constant (O(1)), linear (O(n)), quadratic (O(n^2)), logarithmic (O(log n)), and exponential (O(2^n)). These represent the order of growth of an algorithm's running time as the input size increases.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
802
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
943
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
936
  • Engineering and Comp Sci Homework Help
Replies
3
Views
935
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
2
Views
136
Back
Top