This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am making the [title] algorithm and I have ran into some problems I can't really understand. It's nothing too complicated, one class reads a file and passes it as a linked list to the main algorithm method(table ->divison). From there, one cluster is created from the start table, the distance matrix is calculated. The highest distance is found and the cluster is split into two. And so on, till some kind of ending, iteration count etc. The algorithm works well for one iteration only, afterwards... I can't see where the possible error is, any help would be greatly appreciated. It's my whole days work, probably can't think straight anymore. Thanks in advance!
Janis Strautins wrote:I can't see where the possible error is, any help would be greatly appreciated.
Well, I hate to say, but the minute I see anything like:
my brain just shuts down.
My suggestion: refactor your code to rationalise all these horrible method chains. You (and we) will be in a much better position to then read your code and understand what it's trying to do.
PS: DontWriteLongLines (←click). I've tried to break yours up as best I can, but you're hamstringing yourself by
(a) Aggressive indentation. (Tip: DON'T use tabs).
(b) The number of layers you're handling at a time.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here