time complexity for a given plot

조회 수: 6 (최근 30일)
Mathematica
Mathematica 2020년 8월 30일
답변: Prudhvi Peddagoni 2020년 9월 2일
Hi,
I want to give the time complexity for a specific algorithm. I computed the time it requires to execute the algorithm for different size of inputs.
for n=10 it takes 0.30 seconds, for n=20 0.41 seconds ,for n=40 0.87 sec, n=80 4.9 sec etc.
My question: How can I in general, give the time complexity in O notation for such a given plot representing the time it requires for different size of inputs ?

답변 (1개)

Prudhvi Peddagoni
Prudhvi Peddagoni 2020년 9월 2일
Hi Mathematica,
You can plot the graphs of Y=, Y= and Y=X with your data (n vs time ) and compare which pattern it is following.
documentation for the plot function can be found here.
For more accurate results, time complexity will have to be calculated using theoretical methods.
Hope this helps.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by