joshipura
7/27/2015 2:54:00 PM
[I self-taught Computer Science curriculum - so I may be terribly off in my observations.]
All,
I have three observations (2.1, 2.2 and 2.3) to solicit your comments for my learning. For the below discussion, "data structure" means "data structures as described in normal undergraduate text books".
I have read a lot of discussions on the web loosely calling one data structure (say, a list) being less complex than the other (say, a tree). That kind of confuses me.
I know a bit about complexity of a particular algorithm regarding a data structure but what is the complexity of a data structure? It is easy to discard the notion of "data structure A being less complex than data structure B" as loose talk - but intuitively we "feel" that a graph is considerably more complex than anything linear. What is the measure of inherent "complexity" of a data structure?
Now assume that the text book order of introducing data structures (lists/arrays, stack, queue, tree, graph) indicates complexity somehow. In linear structures the relation between two connected links is one-to-one, in trees it is one-to-many and in graphs it is many-to-many. That way, a graph should be the most complex data structure because there isn't a more complex relation than many-to-many.
However, when I tried to imagine chemicals as nodes of a graph, and an arch as a chemical reaction, an arch needing more than two sources will terminate on one chemical.
For example, a branch originating from H2 and O2 will end up in H2O.
In case of Carbon burning, it may get even worse because edges starting from C and O2 may end up at two places - CO and CO2.
Question 1: What is this data structure with multi-source, multi-destination arch called in the literature? It appears to be "more complex" than a graph.
I could imagine more complex a data structure - the one with catalysts. A multi-source, multi-destination arch would require something that isn't even a source or a destination - a catalyst!
Question 2: Then, such "triangular arch" graph would be even "more complex" than Question 1. What is such data structure called in the literature?
Another interesting point of view can be gained if we try to see when we try to store the data of data structures as relations. List and Tree can be stored with one key reference (of previous node) as a field. (An irreducible) Graph will need another edge table indicating nodes with a composite keys as the primary key.
In that sense, Question 1 and 2 will require multiple-composite-primary-keys of nodes to indicate an edge in that edge table [for fixed number of chemicals reacting with each other, of course. Or we need third table of reaction participants.]
Question 3. Is this what we mean when we say "data structure A is more complex than data structure B"?