Program/algorithm to find the time complexity of any given program

后端 未结 4 2033
北恋
北恋 2020-12-16 04:13

I like to know whether it is possible to \"write a program or algorithm\" to find the time complexity of any given program

4条回答
  •  心在旅途
    2020-12-16 04:47

    can't we introduce some more variables in the algorithm itself and find the complexity the same way we do it manually. like for example we can have a variable in an insertion sort say n=0 which keeps the track of the entire looping part of the algorithm and then give the answer as O(n^2)

提交回复
热议问题