Hello everyone, I am a beginner in c++ programming. I was learning data structures & algorithms and came across the knapsack problem, optimal merge pattern, traveling salesman problem, etc. Although I understood how they work, I am facing a little problem while trying to implement them in C++. Can someone suggest to me how I can improve so that I can solve various implementations of these algorithms? Thanks in advance :)
As a beginner, I think you should steer away from the knapsack problem, AKA traveling salesman problem, These problems are "NP complete" which means that finding an optimal solution is takes absurdly huge amounts of time for reasonably large problems (think "longer than the universe has existed").
Try some easier problems first to get a feel for programming. Once you're fluent, you can try tackling these harder problems.