title: Computational complexity of a longest path algorithm witn a recursive method
body: <p>I wrote a code segment to determine the longest path in a graph. Following is the code. But I don't know how to get the computational complexity in it because of the recursive method in the middle. Since finding the longest path is an NP complete problem I assume it's something like <code>O(n!)</code> or <code>O(2^n)</code>, but how can I actually determine it?</p>
  
  <pre><code>public static int longestPath(int A) {
      int k;
      int dist2=0;
      int max=0;
  
      visited[A] = true;
  
      for (k = 1; k &lt;= V; ++k) {
          if(!visited[k]){
              dist2= length[A][k]+longestPath(k);
              if(dist2&gt;max){
                  max=dist2;
              }
          }
      }
      visited[A]=false;
      return(max);
  }
  </code></pre>