MC wrote on Jun 12th, 2010, 12:18pm:Java code works fine, if you add new knots to ti[] array (should be k+n+1 knots).
if the size of an array depends on the values of other constant settings then those settings should be final statics defined at the top of the code and the array size defined in terms of these.
readability of the code is borderline terrible. i know it's inherited code but... here are some guidelines. these are often personal preferences (and often provoke religious wars) but this is my list, honed over the years and not set in concrete.
using N and n as names is asking for trouble - the sound they make in your head when reading code is the same so they are easy to confuse. using l and i (and l1 and i1) is also asking for trouble even if programming fonts usually make them look different. single character variable names are generally a poor choice.
compound lines like
int jb = i-m+1; if (jb < 0) jb = 0;
make it easy to skip important stuff when reading quickly. so use one statement per line. and use brackets around code blocks, even if the block is only one line long. anything else is cutting corners and will get you in the end. (especially necessary when posting to forums that'll sometimes chomp leading whitespace)
i always use spaces around operators too: i - m + 1, makes it easier to scan. it's not like you're wasting paper 8)
good spot guyy. netbeans also warns me that the k used as a for loop counter is hiding the global k in that one method, but i don't think it matters.