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.
struct AdjacencyListsin the initial code is not used anywhere and its purpose is not explainedthe assertion messages are laughable:
The expression dotest (a, 1) is false.the code blocks in the description use C with an incorrect language tag (
Cinstead ofc) so they do not render properlyThe datatypes are all over the place:
booltypedef; it's super confusing. The input is noted asconst Graph *adjacencyListsbut what we really are passed is aconst struct Edge *const adjacencyLists[], and the typedefs and pointer notation makes this very hard to understand. The latter notation is massively clearerconst: we are supposed to mutate neither the inner structures nor the outer array that contains themAs I had told you, hiding a pointer to a struct under a typedef is really stupid and confusing. You did not address that, which was one of OP's complaint.
This was the third report of it being a duplicate in the comments, so I already sent it back to draft to remove it from the beta pool and avoid it being approved, no retirement necessary.
I noticed you reraised. What do you propose, retire?
Added an example with a picture of a directed graph and an adjacency list description of it.
Will close issue for now. If any suggestions, make a Suggestion out of it.
When re-reading the Wikipedia article, I noticed it uses "adjacency list" (singular) to describe an array (plural) of linked lists (plural), each linked list describing the "adjacent" vertices of a vertex, whereas I called the type "AdjacencyLists" to reflect the "list/array of lists".
I'm open to change that if that would help.
AdjacencyLists is basically a wrapper type for Graph
*adjacencylistsandnvertices, used in the call toisTree.It's for additional clarification of the "Node" and "Graph" types, which by itself do not fully describe the data structure.
It basically models both the (pointer to the) array of
Graphwithnverticeselements, i.e. all the adjacency lists of all the vertices in the graph, and the number of elementsnvertices, in a single type, something that a pointer by itself does not capture.You can think of it as the array of (per vertex) adjacency lists.
adjacencyLists[i]is the adjacency list of vertexi.In the sample code
AdjacencyListsis used, and you can also try to understand the data structure from there.E.g.
and in e.g.
static AdjacencyLists exampleGraph (int code) { ... }Node*/GraphGraphI you have a suggestion to improve the description, please let me know. The data structure is probably the most difficult part to comprehend; did you read the Wikipedia page on Adjacency Lists?
It is a duplicate of existing polynomial parsing kata. Computing a definite integral of a polynomial function is a simple task (compared to parsing).
I don't see an issue with that, it's unique in its combination, lifting it to a next level.
There are at least 4 numeric integration Katas, so having multiple katas on the same topic in itself is not an issue.
And it has a good satisfaction rating by its solvers.
If you still see a fundamental issue, please re-raise the issue and discuss in here.
also, lol. you like to complain about assertion messages, yet
The expression dotest (a, 1) is false.is what you give us ? you need a taste of your own medicineintis maybe an acceptable bool-ish value in the golfed crap you write for yourself, not in a modern codebase and even less so in a Codewars kata. hiding a pointer to a structure under a typedef is terrible: it makes it look like it's a value type, but it's not, it's passed by reference. you also fail to understand the difference betweenconst type *andtype *const, so the input is not actuallyconstin a way that matters.This Kata still confuses me.
Graphis a pointer to aNode, shouldn'tisTree()just pass in aGraphand not a pointer to it?AdjacencyListsisn't used anywhere. Should theproxpointer inNodeuse this type like the comments suggest?Graphis a pointer, why doesAdjacencyListsuse a pointer to it?Overall I think it may make sense to just remove the type
Graphand just use pointer toNodeand make it a pointer (that's more clear IMHO).Loading more items...