## C Traveling Salesman Problem Video

### C Traveling Salesman Problem

Travelling Salesman Problem using Dynamic Programming – Easiest Approach with Code

Check courses on – http://online.codingblocks.com [Free Trial Available]

Coding Blocks is pleased to announce courses like C++ and Java, Data Structures and Algorithms, Web and Android Development(Java and Kotlin), Competitive Programming, Coding Interview Preparation and Machine Learning, AI and more.

#CodingBlocks #ProgrammingMadeEasy #LearnCodingOnline

Code – https://codingblocks.com/ide/#/s/3899

Like our FaceBook Page – https://www.facebook.com/codingblocksindia/

Follow us on Instagram – https://www.instagram.com/codingblocks/

Follow us on Twitter – https://twitter.com/CodingBlocksIn

Source code available on -https://github.com/coding-blocks

For more interesting tutorials – https://www.youtube.com/channel/UCICWIYEx2mo4wYZzLwJ7wVw

This video on this page is automatically generated content related to “c traveling salesman problem”. Therefore, the accuracy of this video on this webpage can not be guaranteed.

Amazing tutorial, looked online for hours but this is definitely the best introduction to the tsp problem. 🙂

How to use dynamic programming if there are more cities than number of bits in integer variable?

Simple and best so far

thanks thanks thanks very much sir ! I was trying to understand this problem for 6 hours in vain, but you explained it very easily.

Thanks sir and hope my comment makes you smile. Please keep up the good work !!!

And literally no idea why is there even a single dislike here !!!!!

I used the Hamiltonian cycle algorithm for my university's delivery service final project. It was the fastest delivery service out of every project submitted.

This doesn't work for cities more than 8. Anyone has a solution for that?

How do we get the path now?

Can you provide the solution of how to print the shortest path

How to get the path now?

Here you have taken the origin as always node 0 for all permutations. What will be the solution if that wasn't the case? i.e. we could start from any node and come back to it after travelling all the nodes.

How to find the path ?

I have a question i hope you could answer to me. How would you print all the visited nodes besides printing the total distance? What could be (and where should be) the line of code? Thanks in advance!

what if there is no direct path from the last node to the first node . in that case the Dist will be 0.but than here we should some other path from last city to the first city, instead of just returning the Dist[last][first].

Why can't we just use a boolean vector to store visited state of the nodes in the graph instead of using bitmask

Thanks a lot. 🙂 I was just looking for this explanation. No one actually explained the bit masking part clearly. 🙂

Where are the solutions in the recursion tree overlapping? Can you help?

Being an algorithm analyst what do you think, "If TSP problem is solved by using dynamic programming approach, will it provide feasible solution better than greedy approach?

Do we ever even hit cache for such small # of cities as in this example? What # of cities would need to hit cache？

Thank you very much sir!