2-6-static linked list-linear table-Chapter 2nd-source code of the data structure textbook-yan Weimin Wu Weimin edition, 2-6-Data Structure
Textbook source code
Chapter 2 linear table-static linked list
-- Data Structure-yan Weimin. Wu Weimin
Source code instructions☛☛☛Data Structure-C language version (Yan Weimin, Wu Weimin version) Textbook source code + EXERCISE set parsing instructions
Textbook source code compilation Link☛☛☛Data Structure textbook source code compilation
Question set full resolution Link☛☛☛Analysis and compilation of data structure question set
File links introduced in this source code☛Status. h
Test data download link☛No data
Source code and test data storage directory in the document: Data Structure \ ▲textbook Algorithm Implementation \ ▲02 linear table \ 06 static1_list
Overview
Static linked lists use arrays to store data. The access method simulates the system's malloc allocation and free collection mechanisms.
Analysis
In the original book "Data Structure", the expression of the static linked list is somewhat complicated. Here it is simplified, but the central idea remains unchanged.
A static linked list is a special sequence table. It is generated from an array (a continuous memory), but its behavior is similar to a single-chain table, it reflects the essence of chain-linked single-chain tables in the system. The static linked list relies on its own cursor to implement the structure pointer of a single-chain table. Therefore, when accessing elements, consider the internal cursor changes in the static linked list, on the other hand, we also need to consider the changes in the remaining memory in the entire space, because the entire memory block is also linked through the cursor.
The static linked list storage structure and access mechanism are as follows:
Possible syntax difficulties
Flexible application of typedef to create new types. For example, when defining a static SPACE, the entire structure array is regarded as a new type Component.
Source code
File 1☛StaticLinkedList. h
File 2☛Staticemedilist. c
File 3☛StaticLinkedList-main.c (test documentation)
Test Result Display
Updating more chapters...