Abstract. The travelling salesman problem is one of the classic optimisation problems that is widely applied in real life, such as in the distribution of goods, transportation route planning, and even the movement of industrial robots. This study aims to implement algorithms for solving the travelling salesman problem using two different programming languages, namely Pascal and C++, and to compare their performance in terms of effectiveness, memory efficiency, and execution speed. The methods used include weighted graph modelling, shortest path calculation, and the application of the Branch and Bound algorithm. The test results show that both programming languages produce identical optimal routes, namely 1 – 5 – 6 – 7 – 10 – 9 – 8 – 4 – 2 – 3 – 1 with a minimum total distance of 196. The Pascal programme has the advantage of a simple syntax structure and low memory usage (±356 KB), while C++ excels in execution speed (0.09466 seconds) despite having a larger output file size (±1.26 MiB). This difference in performance indicates that Pascal is more suitable for educational purposes and small-scale applications, while C++ is superior for complex applications and modern system integration needs. Thus, the TSP algorithm can be implemented effectively using either Pascal or C++, and the choice of programming language should be tailored to the context of the requirements.
Copyrights © 2025