Let's talk about what is called sparse matrix. You said, this question is very simple, then you certainly did not know Chinese academia's lip war, to a word "pull" will lead to two kinds of opposite conclusion. This is Tsinghua's 2000 years of an examination of the postgraduate question: "represents a 1000 vertices, 1000 edges of the adjacency matrix of the graph how many matrix elements?" are sparse matrices? "If you are a person who likes to study the psychological activities of the topic-holders, you can see that there are two traps, that is, let the people in the clear answer the wrong, I do not want to say what is left to the reader to think." Regardless of Tsinghua to give the standard answer is what, that year's reference book is Min's "data structure (c language Edition)", the book's definition of sparse matrices is this: "0 yuan is less than 0 yuan (note: The original book below gives the approximate degree), and the distribution is not a certain pattern", according to this argument, The answer to that question is not necessarily a sparse matrix, because it may be a special matrix (not a 0-element distribution with regularity).
Since 2002, many concepts have changed, most notably from the start count (0 or 1), resulting in the height of the empty tree becoming-1, and only one root node with a tree height of 0. Unfortunately, the problem of tree height is almost every year, in your pen, always make a point of muttering, is not Schon it, will the answer is a compatible version? Then, in the new reference band's problem set, citing the subject, the answer is sparse matrix. You may be surprised that these days the fish can swim, but this answer and the book is not contradictory, because in this yellow book, there is no special matrix, nature must be sparse matrix.
In fact, these two books have no problem in principle in this matter, the C version is from the data structure to distinguish between special matrix and sparse matrix, after all, they realize very different; a new book a brain that treats a matrix of less than 0 yuan as a sparse matrix, when you follow this line of thinking, A variety of special structure of the 0-dollar matrix, if the use of a cross-linked list to store, than the special structure to take into account its unique storage methods, is simply a waste of a few table head node and some pointer fields, and then some of the efficiency of the reduction of operations. From my personal point of view, I prefer to be more unified, less special, even at the expense of a little efficiency; so I agree with the new reference book in this regard. And at the beginning of counting, I prefer the original approach; after all, studying data structures takes into account people's thinking habits, not what computers like; you have to say that the first element in the table is the No. 0, the height of the empty tree is-1, how not to make people feel a pimple. The data structure is the bridge and the intermediary that people constructs the arithmetic, the thought and the computer realizes, it should conform to the person's thinking habit, even if it makes some transformations inside when it realizes. began to nonsense so much, hope did not dispel the mood that you look down, good, go to the heart.