Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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,

share|improve this question
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 '11 at 13:30
    
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 '11 at 19:56
1  
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. –  Pankaj Upadhyay Aug 23 '11 at 5:23
add comment

9 Answers

up vote 32 down vote accepted

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.

share|improve this answer
    
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 '11 at 2:50
    
Good old Big Ohno notation... –  user1249 Aug 22 '11 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. –  EOL Nov 21 '11 at 8:11
add comment

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.

share|improve this answer
1  
+1 for such a "modern" comment. Learning and teaching algorithms should be reserved to people who really need to implement them. –  EOL Nov 21 '11 at 8:12
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

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
share|improve this answer
add comment

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

share|improve this answer
add comment

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!

share|improve this answer
add comment

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...

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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