Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which is a better language (C++ or Python) for complex problem solving exercises (ex. Graphs)?

I am trying to work on some problems and algorithms. I know C++ but a friend told me that it would be better if done with Python.As it would be much faster to develop and less time is spent in programming details which does not actually earn anything solution wise.

EDIT 2: I plan to use python-graph lib from Google-codes, Please provide example codes if you have used it.

EDIT 1: faster - less time && less work to code the solution

Thank you all for your help !

like image 696
Ramadheer Singh Avatar asked Nov 26 '22 20:11

Ramadheer Singh


1 Answers

I think you're looking for Python, because you can:

  • Focus on the algorithms themselves and not have to worry about other detail like memory management.
  • Do more with less code
  • The syntax is almost like working with pseudo code.
  • There is great built in language support for lists, tuples, list comprehensions, etc...

But more specifically...

  • If by better you mean speed of development, then chose Python.
  • If by better you mean sheer execution speed, then chose C++.
like image 123
Brian R. Bondy Avatar answered Nov 29 '22 11:11

Brian R. Bondy