2-1-single-chain table ordered Storage Structure-linear table-Chapter 2nd-Data Structure textbook source code-yan Weimin Wu Weimin edition, 2-1-Data Structure

Source: Internet
Author: User

2-1-single-chain table ordered Storage Structure-linear table-Chapter 2nd-Data Structure textbook source code-yan Weimin Wu Weimin edition, 2-1-Data Structure

Textbook source code

Chapter 2 linear table-sequence storage structure of a single-chain table

-- 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 \ 01 SequenceList



Of course, the learning of data structures should start with linear tables, while the linear tables first need to learn single linked lists. Here we start with the simplest sequential storage structure (essentially variable array storage) of single-linked tables.


A single-chain table emphasizes that elements are logically close to each other, so we first think of using Arrays for storage. However, regular arrays have insurmountable capacity limits. It is difficult to determine an appropriate capacity without knowing the number of inputs. A better solution is to use dynamic arrays. First, use malloc to apply for a memory with the specified initial capacity. This memory is used to store single-chain table elements. When the input content increases constantly and exceeds the initial capacity, you can use calloc to expand the memory capacity, so that the memory is not wasted, and the capacity of a single-chain table can be adjusted as the input increases.

The sequence storage structure of a single-chain table is as follows:

Possible syntax difficulties

The sequence storage structure of a single-chain table may be the first hurdle for a new contact with the data structure. This involves struct, dynamic arrays, structure pointers, and even function variables (functions are used as parameters, essentially function pointers). Therefore, a relatively solid language syntax is required. Of course, this does not mean that you must have mastered the advanced syntax to start learning the data structure. You can first learn the linguistics to get started (the entry means you have learned to ask questions), and then learn the data structure while consolidating the syntax. You must manually write data. Otherwise, it is certainly hard to learn.

Source code File 1☛SequenceList. h

File 2☛SequenceList. c

File 3☛SequenceList-main.c (test documentation)

Test Result Display

Updating more chapters...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.