is there any program that can compute or simulate the time complexity of java and c++?

Recommended Answers

All 6 Replies

http://en.wikipedia.org/wiki/Big_O_notation
It's an estimate of the complexity based on the algorithms you use.

It doesn't care about such things as your operating system, programming language, hardware. It's merely to suggest that if you double the data size, does the time taken also double (O(n)), or quadruple (O(n*n)).

You can't compute the complexity of a program by inspecting the source code with another program.

but is it possible to apply the bigO notation in a program?

For a given program, you can by inspecting it determine what the bigO result of the program is likely to be.

If your program just sorted some data, then you could easily work it out from looking up what the bigO result for your chosen sort algorithm is.

i am working a project and i need help.... i need to create a program that can read c++ and java code to compute their time complexity..... i have been suggested to use java as a PL... my problem is i don't know how to get started, i'm thinking of computing the complexity by batch in the codes. what do you think?

It is impossible to make a program that can compute the time complexity of any program. But you _could_ compute the time complexity for some trivial algorithms. You need to tell us on what subset of the set of programs you want to support computing time complexity.

Complexity is determined from examining algorithms, not implementations.

Bubble sort is O(N*N) no matter how you choose to implement it.

Nor is complexity computable either, for that would be tantamount to also solving the halting problem as well. It is an asymptotic estimate of the upper bound of the performance of the algorithm.

Try some research.
http://en.wikipedia.org/wiki/Big_O_notation

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.