time complexity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amana
    New Member
    • Sep 2009
    • 2

    time complexity

    is there any algorithm that can find time complexity of any program(recursi ve or non recursive)?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by amana
    is there any algorithm that can find time complexity of any program(recursi ve or non recursive)?
    No there isn't and the proof is analogous to the Turing Halting Problem proof:

    suppose you have such an algorithm A(P) such that A(P) == O(f(n)) which indicates the big-Oh value of P. Consider this P:

    P(n): if A(P) == O(n) then do something O(2^n) else do something O(n)

    kind regards,

    Jos

    Comment

    Working...