I'm a PHP programmer, and until now I have not needed to learn algorithms...

Now I'm start learning Python (a real programming language), because I need to use matplotlib. Does it make sense to start by reading a Python algorithm book and then learn matplotlib and numpy or should I jump to matplotlib and numpy?

Best Regards,

  • 2
    If you don't learn algorithms, and understand what is most appropriate for a given task, you end up with answers like the ones on this question: stackoverflow.com/questions/5498865
    – kdgregory
    Apr 15, 2011 at 13:30
  • 1
    You've probably implemented a few algorithms already, without actually knowing their names or the theory behind them. It's hard to believe anyone could do any useful programming at all without implementing some algorithms.
    – tdammers
    Aug 22, 2011 at 19:56
  • 2
    algorithm is just a common sense of How to do the things in optimal way. In programming you need to use the minimum resources and ensure performance, hence you are using it all the time. BTW, what does this mean Python(a real programming language) ??? PHP is as good as anything else. It's just that it's more of a web scripting language and mind you, it's the best in business for long long time. Aug 23, 2011 at 5:23

9 Answers 9


Absolutely. Without knowing algorithms, how else are you going to understand how a program does what it does?

It's essential to understand algorithm development so you can program more efficiently and write better programs. Starting out you should at least know the basics of concepts like control flow (maybe via state automaton, but that's not always necessary) and Big O notation and how it can affect performance.

  • While I agree, just how much should one know on the scale of passing an intro to algorithms at a local community college the second time around to being Donald Knuth?
    – Job
    Aug 22, 2011 at 2:50
  • Good old Big Ohno notation...
    – user1249
    Aug 22, 2011 at 15:08
  • 1
    I agree with the importance of knowing about algorithm complexity ("big O notation"). However, I strongly disagree with the "absolutely" answer to the "is it essential to learn algorithms to be a real programmer"; in fact, learning Python well is much more useful than knowing how to sort a list (since Python sorts lists for you) or how Python handles dictionaries (which Python programmer ever needed to implement a hashing mechanism?), etc. Historically, people have learned algorithms because they're language did not provide them out of the box; the modern era is different. Nov 21, 2011 at 8:11

The answer is both yes and no. You don't need to know the details of how different algorithms work or the theory behind them -- that's the job of computer scientists -- but you do need to know the basics, such as what algorithms are available for solving a particular task and which one is best for a given situation.

In your case, you can simply start using the libraries you mentioned -- they were built by someone only to make life easier for others. You certainly don't need to know the algorithms that went into building it just in order to use it.

  • 2
    +1 for such a "modern" comment. Learning and teaching algorithms should be reserved to people who really need to implement them. Nov 21, 2011 at 8:12

Yes, so that you understand how to apply one approach over another. You also don't want to "reinvent the wheel" as there are many existing algorithms that already work. If you don't know they are out there you will waste time inventing a potentially weaker solution and not even understand why it's weaker.


Algorithms to a programmer is a hammer to a blacksmith. Sure you can get by without and use alternatives to get the job done, but if you want to do it right and do it well it is essential.

Good thing about algorithms is that it is programming language independent, so learn the theory once and you can implement it in any language. Here is a good website that I've been building to start learning from: www.ambesty.com They use Java but it comes with sample code to learn from. They offer simple ADT and Sorting algorithms to more complex ones like data compression algorithms. Very interesting read. Good luck


Depending on your PHP experience, if you're at the stage where you can adapt the basic programming concepts from one language to another, do so. This would be the most efficient way to spend your time.

Read what you need to do to integrate Matplotlib, numpy, and Python. And then if you get stuck, keep diving deeper. I recommend this order because

  • it's less time-consuming
  • you probably won't be applying every algorithm you read about

If you are developing business applications (only), Get to learn the basics only, such as lists, queues, sorting, string search, etc. so that you'd learn the terminology, how performance is affected and measured and so on. A better use of your time would be to focus on new technology, OO patterns, effective database design, app. development methodologies, and such!


Ok - I know this is not exactly what you meant, but you allready know (how to do) algorithms. Depending on your definition you can take every progamm as a example for an algorithm.

So don't fear. It's usefull to know the basic algorithms, it's more usefull to know the basic data-structures but it's even better to know the design-"patterns". Afterall the basic algorithms and data-structures will be implemented in your framework of choice but the patterns will most likely not...


Learn python first then if you feel like it you can study algorithms; Because algorithms aren't python specific - they are general all languages.


Before I started at the University, I believed I was a fairly decent programmer, and I did have a couple of years of work experience. But after I've learned about algorithms and datastructures at the University, I feel it is knowledge that you have to have! It is essential for everything you do. Even though you might not use that knowledge directly every day, it will still be at the top of your head, and it will make you a better programmer.

You learn a lot about performance, and even though performance usually isn't number one, knowing algorithms will prevent you from doing some stupid stuff, with really bad performance. Even though performance isn't number one, there isn't any reason not to use that knowledge for making the right decisions.

Not the answer you're looking for? Browse other questions tagged or ask your own question.