[ACCEPTED]-Improve algorithmic thinking-algorithm
Solve problems on a daily basis. Watch traffic 27 lights and ask yourself, "How can these 26 be synced to optimize the flow of traffic? Or 25 to optimize the flow of pedestrians? What 24 is the best solution for both?". Look at 23 elevators and ask yourself "Why should these 22 elevators use different rules than the elevators 21 in that other building I visited yesterday? How 20 is it actually implemented? How can it be 19 improved?".
Try to see a problem everywhere, even 18 if it is solved already. Reflect on the 17 solution. Ask yourself why your own superior 16 solution probably isn't as good as the one 15 you can see - what are you missing?
And so 14 on. Every day. All of the time.
The idea 13 is that almost everything can be viewed 12 as an algorithm (a goal that has some kind 11 of meaning to somebody, and a method with 10 which to achieve it). Try to have that in 9 mind next time you watch a gameshow on TV, or 8 when you read the news coverage of the latest 7 bank robbery. Ask yourself "What is the 6 goal?", "Whose goal is it?" and "What is 5 the method?".
It can easily be mistaken 4 for critical thinking but is more about 3 questioning your own solutions, rather than 2 the solutions you try to understand and 1 improve.
First of all, and most important: practice. Think 33 of solutions to everything everytime. It 32 doesn't have to be on your computer, programming. All 31 algorithms will do great. Like this: when 30 you used to trade cards, how did you compare 29 your deck and your friend's to determine 28 the best way for both of you to trade? How 27 can you define how many trades can you do 26 to do the maximum and yet don't get any 25 repeated card?
Use problem databases and 24 online judges like this site, http://uva.onlinejudge.org/index.php, that has 23 hundreds of problems concerning general 22 algorithms. And you don't need to be an 21 expert programmer at all to solve any of 20 them. What you need is a good ability with 19 logic and math. There, you can find problems 18 from the simplest ones to the most challenging. Most 17 of them come from Programming Marathons.
You 16 can, then, implement them in C, C++, Java 15 or Pascal and submit them to the online 14 judge. If you have a good algorithm, it 13 will be accepted. Else, the judge will say 12 your algorithm gave the wrong answer to 11 the problem, or it took too long to solve.
Reading 10 about algorithms helps, but don't waste 9 too much time on it... Reading won't help 8 as much as trying to solve the problems 7 by yourself. Maybe you can read the problem, try 6 to figure out a solution for yourself, compare 5 with the solution proposed by the source 4 and see what you missed. Don't try to memorize 3 them. If you have the concept well learned, you 2 can implement it anywhere. Understanding 1 is the hardest part for most of them.
Polya's "How To Solve It" is a great book 15 for thinking about how to solve mathematical 14 problems and do proofs, and I'd recommend 13 it for anyone who does problem solving.
But! It 12 doesn't really address the excitement that 11 happens when the real world provides input 10 to your system, via channel noise, user 9 wackiness, other programs grabbing resources, etc. For 8 that it is worth looking at algorithms that 7 get applied to real-world input (obligatory 6 and deserved nod to Knuth's collection), and 5 systems which are fairly robust in the face 4 of same (TCP, kernel internals). Part of 3 coming up with good algorithmic solutions 2 is to know what already exists.
And alongside 1 reading all that, of course practice practice practice.
You should check out Mathematics and Plausible Reasoning by G. Polya. It is 5 a rare math book, which actually deals with 4 the thought process involved in making mathematical 3 discoveries. I think it is the same thought 2 process that is involved in coming up with 1 algorithms.
The saying "practice makes perfect" definitely 25 applies. I'm tutoring a friend of mine 24 in programming, and I remind him that "if 23 you don't know how to ride a bike, you could 22 read every book about it but it doesn't 21 mean you'll be better than Lance Armstrong 20 tomorrow - you have to practice".
In 19 your case, how about trying the problems 18 in Project Euler? http://projecteuler.net
There are a ton of problems 17 there, and for each one you could practice 16 at developing an algorithm. Once you get 15 a good-enough implementation, you can access 14 other people's solutions (for a particular 13 problem) and see how others have done it. Don't 12 think of it as math problems, but rather 11 as problems in creating algorithms for solving math 10 problems.
In university, I actually took 9 a class in algorithm design and analysis, and 8 there is definitely a lot of theory behind 7 it. You may hear people talking about "big-O" complexity 6 and stuff like that - there are quite a 5 lot of different properties about algorithms 4 themselves which can lead to greater understanding 3 of what constitutes a "good" algorithm. You 2 can study quite a bit in this regard as 1 well for the long-term.
I would suggest this path for you :
1.First 14 learn elementary parts of a language.
2.Then 13 learn about some basic maths.
3.Move to topcoder 12 div2 easy problems.Usually if you cannot 11 score 250 pts. in any given day,then it 10 means you need a lot of practise,keep practising.
4.Now's 9 the time to learn some tools of a programmer,take 8 a good book like Algorithm Design Manual 7 by Steven Skienna and learn about dynamic 6 programming and greedy approach.
5.Now move 5 to marathons,don't be discouraged if you 4 cannot solve it quickly.Improvement will 3 not happen overnight,you will have to patiently 2 keep on working hard.
6.Continue step 5 from 1 now on and you will be a better programmer.
Learning about game programming will probably 5 lead you to good algorithms for game programming, but 4 not necessarily to better algorithms in 3 general.
It's a good start, but I think that 2 the best way to learn and apply algorithmic 1 knowledge is
- Learn about good algorithms that currently exist for your area of interest
- Expand your knowledge by viewing other areas; for example, what kinds of algorithms are required when working on genetic analysis? What's the best approach for determining run-off potential as it relates to flooding?
- Read about problems in other domains and attempt to use the algorithms that you're familiar with to see if they fit. If they don't try to break the problem down and see if you can come up with your own algorithm.
A few more books worth reading (in no particular 6 order):
- Aha! Insight (Martin Gardner)
- Any of the Programming Pearls books (Jon Bentley)
- Concrete Mathematics (Graham, Knuth, and Patashnik)
- A Mathematical Theory of Communication (Claude Shannon)
Of course, most of those are just 5 samples -- other books and papers by the 4 same authors are usually quite good as well 3 (e.g. Shannon wrote a lot that's well worth 2 reading, and far too few people give it 1 the attention it deserves).
Read SICP / Structure and Interpretation of Computer Programs and work all the problems; then read 9 The Art of Computer Programming (all volumes), working all the exercises 8 as you go; then work through all the problems 7 at Project Euler.
If you aren't damned good at algorithms 6 after that, there is probably no hope for 5 you. LOL!
P.S. SICP is available freely online, but 4 you have to buy AoCP (get the international, not-for-release-in-north-america 3 edition used for 30 USD). And I haven't 2 done this yet myself (I'm trying when I 1 have free time).
I can recommend the book "Introductory Logic 6 and Sets for Computer Scientists" by Nimal 5 Nissanke (Addison Wesley). The focus is 4 on set theory, predicate logic etc. Basically 3 the maths of solving problems in code if 2 you will. Good stuff and not too difficult 1 to work through.
Great how about trying the problems in 9 Project Euler? http://projecteuler.net
There are a ton of problems 8 there, and for each one you could practice 7 at developing an algorithm. Once you get 6 a good-enough implementation, you can access 5 other people's solutions (for a particular 4 problem) and see how others have done it. Don't 3 think of it as math problems, but rather 2 as problems in creating algorithms for solving 1 math problems
Ok, so to sum up the suggestions:
The most 15 effective way to improve this ability is 14 to solve problem as frequently as possible.Either 13 real world problems(such as the elevators 12 "algorithm" which is already suggested) or 11 exercises from books like CLRS(great, I 10 already own it :-)).But I didn't see comments 9 about maths and I don't know what to suppose(if 8 you agree or not).:-s
The links were great.I 7 will definitely use them.I also think that 6 it will be a good exercise to solve problems 5 from national/international informatics 4 contests or to read the way a mathematician 3 proves a theorem.
Thank you all again.Feel 2 free to suggest more, although I am already 1 satisfied with the solutions mentioned.
More Related questions