P vs NP, finding algorithms in polynomial time?

93 Views Asked by At

Concerning an NP problem, such as the travelling salesmen problem.

Say for a graph with N nodes there exists an algorithm $A(N)$ which can solve the problem in time $N^3$ (for example).

But.... to find each algorithm $A(N)$ takes $2^N$ steps. However, once you have an algorithm $A(N)$ you can solve any graph with $N$ nodes in $N^3$ steps.

So my question is, is this P or NP? Since in practical terms if you found the algorithm for graphs with 100 nodes $A(100)$, you could solve all graphs in time $100^3$.

Or is it somewhere in between?

Obviously the algorithm for finding algorithms $A(N)$ is NP. But the set of algorithms once found $A(N)$ works in P.

Edit: Because it is unclear

Consider a computer program called A(10) which can solve the travelling salesman problem for 10 nodes in $10^3$ steps.

Now consider another unrelated computer program A(11) which can solve the travelling salesman problem for 11 nodes in $11^3$ steps.

Another third completely different computer program A(12) which can solve the travelling salesman problem for 12 nodes in $12^3$ steps.

Consider a computer program B (a meta program) which can construct different computer programs A(N). Program B takes $2^N$ time to construct the simplest computer program to solve the case of N nodes.

Running program B can generate different computer programs A(1), A(2), A(3),... for all the different numbers of nodes.

Perhaps it can be proven that program B can create programs A(N) that run in $N^3$ steps. Hence a travelling salesman visits lots of countries and always visits 100 cities. Using the program B he generates an algorithm A(100) that runs in $100^3$ steps. This is very useful even though no general algorithm exists.

1

There are 1 best solutions below

4
On BEST ANSWER

If every $N$ requires to run a procedure that "builds" an algorithm in time $2^N$, then to execute the algorithm in time $N^3$, the complete task has exponential complexity.

You may not assume that the algorithm for any $N$ is available at no cost, as this would require infinite precomputation and storage.


Note that this discussion has nothing to do with the NP class of problems.