Home > Back-end >  Annoying problem, after programming experience
Annoying problem, after programming experience

Time:10-26

This several days to programming comments:

Seriously, "converting adjacency matrix adjacency list and output, and then the adjacency list for topological sort" this topic is really annoying, I did about four days, is to convert the adjacency matrix adjacency list this function is complete, but behind the topological sort is what also do not to come out,

I spent two days in the four days to finish the first function, first step conversion of kinetic energy need four, establish a matrix and output matrix (this step can not), conversion and output list, the first day, I will first establish adjacency matrix, the output adjacency matrix, and the output adjacency list first to complete the three things, to perfect the list after the matrix transformation output of this function, just the most important third transformation, I defined a new node, after all, the table must be used to use chain node operating data, but when I put the vertex data and weight after the transformation, compile-time errors, runtime, however, no matter how to have a wrong, the transformed list is lost not to come out, this is really a little irritating, later, I was thinking, step by step, verification, testing and hope to find out the errors in the program, spent about three hours, I found a mistake, grandmother of, is I don't have to apply for a new node space in, I just use my create Edge defines the structure of the body node * p, but not for the p application space, this is really shouldn't make low-level mistakes, when I put the error correction, matrix transformation list the function is complete, the heart is really sorry, I can put such an important step in the linked list data structure operations forgot,

For this mistake, I summed up a little later, that is if you don't use the operation of the stack and queue, then after defined the node, you must apply for a new space,



Two days later, in addition to class, read a book, the rest of the time is to make c + +, the natural, the second function of topological sort is naturally want to do, but no matter how I, I can't finish the topological sort this feature, check a lot of information, the core of the topological sort is to use the ideas of the stack, first put into the degree of 0 vertex in the stack, and then output to those behind the vertex into successive minus 1, who first to 0, who go into the stack, then the output (here will need to use cycle), but I do is to use the idea to do, but is to make a mistake, compiled without an error, the runtime is to make a mistake, can't output the desired results, the third day is spent in depressed, as for the fourth day, I will slowly find errors, and tested many times, finally find out the mistakes, grass, was wrong at the time of the stack, I can't think why yes, when into the stack when the stack is wrong, wrong is rooted in the stack to the data in the output, then spent a lot of time, finally make a lot of methods have half right, a little sad, spent a lot of time, check a lot of information, to make the half, the half is put into the first degree of 0 elements of the output, as for the back into the degree is not 0, alas, I touch, & lt; -_ - & gt; ,

Alas, is how poor fellow, it took so long time has only come up with the function of one and a half, but in order to software engineering, in order to can have a good development in the future, in order to be successful, throwing caution to the wind, Lao tze also had to

Today I also only to ask the teacher how the topological sort, look at what she did,

Summary: no, you're looking for information, don't know when, want to get to the Internet to find the answer, at the same time, remember, if you meet again in the future nodes, must not to lower the same mistake again, simple mistake but big fear of the programming,

For their own requirements: pay special attention to basic knowledge, improve the efficiency of programming, spend less time, complete function better, after all this is the era of rapid development, the day we still use the window, you still play apple yesterday, today already tend to andro, don't know tomorrow apple, andro will become a thing of the past? !

CodePudding user response:

Advertising is this?

CodePudding user response:

Mastering basic data structures and algorithms, no matter in which are useful in development environment

CodePudding user response:

In order to study, do your own list, justifiably, if do project, don't need, CB has a ready-made list, queue, can do can do stack,

CodePudding user response:

CB has a ready-made list, queue, can do can do stack, detailed point?

CodePudding user response:

reference 4 floor wirner response:
CB has a ready-made list, queue, can do can do stack, detailed point?


The list of the STL can be used

CodePudding user response:

Understand algorithm point quite good, but it is not necessary to dig into overly, now a lot of have a ready-made,
  • Related