Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Common or well-known algorithms?  RSS feed

 
David Crossett
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! I am relatively new to Java (and love it!). I'm discovering that 'coding' is actually the easy part. Figuring out how to solve a particular problem is the 'thinking' part. Are there books or web-sites (I prefer free) of common or well-known algorithms and the problem they solve? For example, evaluating a leap year seems to be a popular one that is learned quickly when learning a new language. I'm sure there are others... how can I find them?
Thanks!
David Crossett
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java almanac is a good place to find things you would commonly do in code.
http://javaalmanac.com/
These are useful however, if you are looking for even more generic solutions I recommend the Martin Fowler book on refactoring and the Gang of 4 Design patterns books. The amazon links for each follow and both are well worth the money:
1) refactoring - http://www.amazon.com/exec/obidos/tg/detail/-/0201485672/qid=1066964048/sr=1-6/ref=sr_1_6/102-4756292-7424125?v=glance&s=books
2) design patterns - http://www.amazon.com/exec/obidos/tg/detail/-/0201633612/qid=1066964106/sr=1-1/ref=sr_1_1/102-4756292-7424125?v=glance&s=books
 
fred rosenberger
lowercase baba
Bartender
Posts: 12441
42
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used a book called "introduction to algorithms" in college. it give very generic solution to LOTS of common problems - from sorting to traversing to everything.
http://www.amazon.com/exec/obidos/tg/detail/-/0262032937/qid=1067363073/sr=8-1/ref=sr_8_1/103-1044406-3503848?v=glance&n=507846
expensive, and VERY high level math stuff, but i still go back and re-read it every so often.
It talks a lot about analyzing your data before trying to come up with "THE SOLUTION". example: i had a problem at work where it was taking a program DAYS to do something.
i found it was using a Quicksort algorithm, on a HUGE file that was already sorted. Guess what? that's a bad idea. so i wrote a bubble sort (which is usually considered quite bad), and reduced performance time from 3 days to 2 hours.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!