0

Basically I'm not sure how to measure time complexity.

I know that TSP is an NP-hard problem, that means that the time complexity of an algorithm used to solve it is exponential: O(2^n)

What if I divide into sub-problems and solve the subproblems them combine them to form a complete solution? The time complexity is less right? Maybe something like:

O(n) = 1 if n = 1 O(n) = a (n/b) + cn

A problem of size n is divided into a subproblems of size n/b, here cn is linear time complexity.

Ref: http://devernay.free.fr/cours/algo/docs/10%20-%20Time%20Complexity.pdf

So does that mean time complexity is O(n log n) if you have a divide an conquer approach? I feel like there is something wrong with this logic. It cant be possible to reduce exponential time complexity to n log n through a divide and conquer approach.

What is the time complexity of: 1 - Solving TSP => exponential O(2^n), right? 2 - First dividing TSP into subproblems, then solving subproblems using the same approach used in 1? Surely less than exponential?

Sorry I'm a little confused, any help is appreciated.

MTA
  • 739
  • 2
  • 9
  • 29
  • 2
    Not sure what you have in mind specifically when you say "divide into sub-problems and solve the subproblems them combine them to form a complete solution", but in general an approach like this is not going to give you the optimal solution. The fact that TSP is NP-hard means that there is no known *exact* algorithm for it, but there are certainly many *heuristic* (approximate) algorithms for it that run in polynomial time. Yours sounds like one of them. – LarrySnyder610 May 05 '17 at 02:21
  • @grendelsdad thanks for responding, i really need some help! Yes its an approximate approach, I just need to show that using decomposition (a divide and conquer approach) deals with my subproblems in parallel, therefore the time required to find (approximate) solutions for those subproblems is less than the time required to find an approximate solution if you were to consider the problem as a whole. Therefore its a divide and conquer kind of approach. – MTA May 05 '17 at 10:57
  • I can't comment on the complexity of your approach. But having an approximate method that runs in polynomial time does not contradict TSP being NP-hard, which I thought was the essence of your question. – LarrySnyder610 May 05 '17 at 14:49
  • @grendelsdad That's not what NP-hard means. There *are* exact algorithms to solve TSP, just not in polynomial time. – beaker May 05 '17 at 19:49
  • @beaker Sorry, I meant no known exact *polynomial-time* algorithm for it. – LarrySnyder610 May 06 '17 at 13:59
  • @beaker my problem is: does using a divide and conquer approach (decomposition) reduce the time complexity of solving tsp? And how? – MTA May 07 '17 at 00:31
  • @RegUser No it doesn't, because each subproblem has the same time complexity as the whole problem (just smaller individual input sizes `n`), and you have to take into consideration the complexity of recombining the subproblems. – beaker May 07 '17 at 02:22
  • @beaker thanks, i didn't think of that, is there any way to reduce the complexity of a problem like TSP? – MTA May 07 '17 at 10:41
  • Only if `P = NP`. – beaker May 07 '17 at 14:15

0 Answers0