Crossing, everyone, from today onwards, we talk about the large-scale couplet science fiction: C Chestnut, that is, C language examples. Gossip Hugh,
Words return to the positive turn. Let's talk C chestnuts together!
Crossing, the last time we talked about the list and the single-linked list of sequential storage examples, this time we continue to say the single-linked list of examples, not
This time we're talking about single-chain table storage.
Crossing chain storage of single-linked lists, we have said in the last time that there is no more to say here. The main example of this is to
Describes what is chained storage for single-linked lists.
This can be seen by comparing the sequential storage and chained storage of a single-linked list.
The advantages of sequential storage chain list: It is convenient to traverse the linked list and find it conveniently.
the disadvantage of sequential storage list: Delete, insert element is more cumbersome.
Advantages of chained storage lists: Inserting, deleting elements is convenient. Traverse and find more complex
The disadvantage of chained storage lists: traversal and lookup elements are more complex.
In general, chain-store linked list is used more in the actual development, because it is more flexible, and the size of the list can be based on the need to move
With high space utilization.
Crossing, the text does not write code, the detailed code put in my resources, you can click the link to download the use. About the code has
The following points need attention:
1. When creating a linked list in code, use the head node, which makes the list easier to operate. For detailed reasons, you can see the comments in the code.
2. The code has a DEBGU statement, in the code if you define a debug macro, you can print some debug statements, so that you can
Quickly find the cause of the problem. If you do not need debug to define this macro, the macro is not defined by default.
3. The code uses a level two pointer, which is especially careful when used.
You crossing, for example, on single-chain-link storage We're going to talk about this. I want to know what the following example, and listen to tell.
Talk C Chestnut Bar (13th time: C-language example-single-linked list II)