I've been programming in java for almost 5 years now. I'm self-taught, so while I know how to program, I don't know some of the more formal aspects of computer science. So if i were to brush up my knowlegde on algorithms and data structures using java which books can I refer? I just want to be able to figure out when an algorithm/data structure would be an ideal solution to a problem.

Head First Design Patterns is worth a look.

Please do not expect that there is only one best algorithm for each problem because it is most likely not true. Every problem can be solved in different best way depending on many factors, so you must not stick to only one algorithm/data structure as the best solution for each problem.

That said, in CS, you would learn different algorithms and their advantages/disadvantages (with different way to quantify the advantages/disadvantages). You would need to apply different algorithm/data structure to a problem when appropriate. That's why CS is not about programming but rather about concept/algorithm. The programming part is simply an expression of how well one can understand the concept/algorithm.

Also, programming and algorithm/data structure are 2 completely different things. You can program and do not need to understand what algorithm/data structure is, but you need to be able to apply algorithm/data structure to program if you know & understand them. Furthermore, algorithm/data structure is not tied to one platform/language but can be applied to any platform/language. So do not be afraid when you encounter any source/book that may not be in Java.

You could a google search for algorithm and data structure and you find tons of link. Try to study as many as you can. This website is from a school in New Zealand and it looks quite good to me (quite in detail). I wish you a good luck.

You can program and do not need to understand what algorithm/data structure is

Actually you do, even if it's informally. Algorithms and data structures are the core of programming. Any time you process data somehow, that's an algorithm. Any time you collect data in storage, that's a data structure.

int[] stuff; // Hey, a data structure!

...

// Oh my, an algorithm!
for (int i = 0; i < n; i++)
{
    sum += stuff[i];
}

Algorithms and data structures aren't limited to the "offical" or "standard" ones that books will describe, though you can learn a ton about how to design your own by studying them.

[quote]Algorithms and data structures aren't limited to the "offical" or "standard" ones that books will describe, though you can learn a ton about how to design your own by studying them.[/quote]

Thank you for elaborate that. What I meant was more on 'technical' term than its literal. When it is your own style, some people don't know that it is algorithm or data structure. It is just something that is thrown into the code. :)

Thanks a lot for all your responses :) :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.