Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
.
Hmm, seems this kata is in limbo. Description has multiple spelling issues. I find the names of the data structure misleading, even a Wikipedia link does not help that much. The argument to the function is a basically an array, so please use C arrays, that helps to understand what's happening.
At this point this kata is basically a duplicate of a mixture of katas:
@hobovsky the author doesn't seem to active.
Why not? It seems you're thinking about the graphs in the sense of discrete mathematics or networks, the author perhaps meant graphs in the sense of plots of polynomial functions.
Should I remove this, or add it as dropdown?
Wait, aren't the coefficient already have possiblility to be negative and fractional? and apart from that it is better to say that coefficients are real numbers.
I guess it is better just to say compute the definite integral of the given polynomial function in the given interval.
.
I've prepared them(but not added them yet)
Okay, I'll change them to doubles.
And What rank would you suggest to this?
It's not clear if the possible root to check is always the first vertex or it can be any.
You can check my C# translation for proposed improvements, or let me know what changes you made so I could adapt the C# translation where necessary.
You are right! I will alter it as soon as i can .. aswell as provide arbitrary exponent range in (natural numbers however).
I provided a C# translation - please review and let me know if it's ok, or something should be adjusted (range of coefficients or exponents for random tests, comparison tolerance, or anything else).
Damn, it's been AGES since I've written any C code!
I liked this kata, but I see following issues:
GRAPHS
as a tag?Int(ax^n) = a/(n+1)x^(n+1)
)."Don't forget coeficients can be negative."
to"Don't forget coefficients can be negative or fractional."
. I know it's very logical that in general coefficient can be any real number, but examples slightly suggest they may be just integers in this kata.roundf
a bit of a stretch? This way, both of these pass:dotest('y', 0, 1, " y^7 + 2y^4 + 1 -y^7 ", 1.4);
anddotest('y', 0, 1, " y^7 + 2y^4 + 1 -y^7 ", 0.6);
. My implementation can return anything between 0.5 and 1.5 and test will still pass. Isn't epsilon-based comparison better?Your are right. I tried to illustrate the topology not the flow.
To clarify the root is the only node that can reach every other.
There are pictures of both directed and undirected graphs in the description, what is expected is not really clear. As I can see, the list of edges is not symmetrical, so it looks like the graphs are directed. So should it be checked that all the edges point either from or to the root?
That's great advice! It has been added to the discription.
Nice kata!
It took me longer than I am comfortable to admit to find out that
struct edge
is a linked list wheredest
is the index of a node in the graph.For convenience you could add a function to the description that shows how a graph is accessed and printed.
Solved.
Random tests are implemented.
Loading more items...