Calculating Complexity of a Problem-Calculation

  • Thread starter Thread starter kioria
  • Start date Start date
  • Tags Tags
    Complexity
AI Thread Summary
The discussion centers on calculating the number of distance calculations in a program that processes N points in Cartesian coordinates. The user has implemented a solution in C and is seeking to express the complexity of their algorithm in Big-Oh notation. They initially present a function f(x) related to the number of calculations but later clarify that it should be f(N). The key focus is on determining the correct form of f(N) and identifying a suitable g(N) to express the relationship f(N) = O(g(N)). The conversation emphasizes the need to analyze the number of loops and operations performed per loop to derive the complexity accurately. The user expresses confusion about the constants involved in Big-Oh notation and seeks guidance on how to properly formulate their function and find the constant C.
kioria
Messages
54
Reaction score
0
I have been given an assignment, a small one, which simply takes in number of points in cartesian coordinate format: (x, y) - then - the assignment specified that the program needed to calculate distances of every permutation possible - then return with the set(s) of points that had the shortest distance.

The problem given is simple, and I have coded in C - works perfectly OK.

But here's the problem:

What is the number of distance calculations executed by your program for an input instance of "N" points, as a function of "N", expressed in Big-Oh notation? JUSTIFY your answer.

I know that my program (which I think is efficient enough at this stage) calculates in this many steps:

f(x) = \sum_{n=2}^N (x - 1)

I also know that Big-Oh notation is something that f(x) is asymptotic to. For example:

g(x) = O(f(x)) = c.f(x) = c.\sum_{n=2}^N (x - 1)

Is this correct way of looking at the Big-Oh notation? How would I find the value of c?

Thanks

 
Last edited:
Computer science news on Phys.org
What's x? Presumably the complexity of your program, for an input of size N is
f(N) = [some function of N]
so I don't see where x comes into the picture.

Ultimately you want to be able to say that
f(N) = O(g(N))

meaning that there is some function g(N) such that your function
f(N) \leq C*g(N)
whenever N > k for some constants C and k of your choosing (k might be 0). C and k are whatever constants you need to make that inequality true. Depends on what f(N) is, so you need to get your f(N) into a more useful form.

(As a start, count how many times your program loops as a function of N, and how many operations it performs per loop.)
 
I messed up with my x's and N's, the top line should really be f(N). I am having trouble finding g(N) and the constant value C.
 
This week, I saw a documentary done by the French called Les sacrifiés de l'IA, which was presented by a Canadian show Enquête. If you understand French I recommend it. Very eye-opening. I found a similar documentary in English called The Human Cost of AI: Data workers in the Global South. There is also an interview with Milagros Miceli (appearing in both documentaries) on Youtube: I also found a powerpoint presentation by the economist Uma Rani (appearing in the French documentary), AI...

Similar threads

Replies
1
Views
1K
Replies
2
Views
2K
Replies
1
Views
2K
Replies
5
Views
1K
Replies
1
Views
1K
Replies
2
Views
3K
Back
Top