[Data Structure] Data Structure and Algorithm (1) – Linear Structure

1. Foreword

Linear structure is a basic data structure, mainly used To describe the data relationship that has a single predecessor and successor in the objective world. That is “arranged one by one”. It is characterized by a linear relationship between data elements.

Second, content introduction

Write the picture description here < /div>

2.1 Linear Table

Write the picture description here

①Sequential storage: the average number of insertions is n/2, the average number of deletions is (n-1)/2

②Chain storage: There are many types, doubly linked list, circular linked list, and static linked list. The test point is to write the code for inserting and deleting the linked list.

2.2 Stacks and queues

  • Features:

    ①Stack: **First-in-last-out**, can be called recursively; 

    ②Queue: **First-in-first-out**, can not be called recursively;

  • Storage method:

Write picture description here

2.3 string

  • Definition:
    String is a special linear table, and the period data elements are characters. A string is a finite sequence of zero or more characters. Generally note S=’a1a2….an’ where S is the string name, and the character sequence enclosed in single quotes is the string value; ai (1<=i<=n) can be letters, numbers or other characters; The number of characters contained is the length of the string. A string with a length of zero is called an empty string, and it does not contain any characters.

  • Storage method:

    ① Order storage: use one Group address consecutive memory cells to store string-valued character sequences. 

    ②Chain storage: Each node can store one character or multiple characters. At this time, the storage density should be considered.

Three, contrast memory

Some of these concepts can be compared The memory is completed, and there are some core knowledge that can be learned by comparison. This is the learning method provided to everyone. This is a very good idea, deep in memory, and can also improve one’s level.

Four. Summary

In this way, through continuous attacks, the time has finally come to reap the results. The data structure is to abstract your own things. By controlling this country, the editor keeps on completing it like this. Come on! !
The next editor will bring you “[Data Structure] Data Structure and Algorithm (1)-Nonlinear Structure”

1. Foreword

Linear structure is a basic data structure, mainly It is used to describe the data relationship with a single predecessor and successor in the objective world. That is “arranged one by one”. It is characterized by a linear relationship between data elements.

Second, content introduction

Write the picture description here < /div>

2.1 Linear Table

Write the picture description here

①Sequential storage: the average number of insertions is n/2, the average number of deletions is (n-1)/2

②Chain storage: There are many types, doubly linked list, circular linked list, and static linked list. The test point is to write the code for inserting and deleting the linked list.

2.2 Stacks and queues

  • Features:

    ①Stack: **First-in-last-out**, can be called recursively; 

    ②Queue: **First-in-first-out**, can not be called recursively;

  • Storage method:

Write picture description here

2.3 string

  • Definition:
    String is a special linear table, and the period data elements are characters. A string is a finite sequence of zero or more characters. Generally note S=’a1a2….an’ where S is the string name, and the character sequence enclosed in single quotes is the string value; ai (1<=i<=n) can be letters, numbers or other characters; The number of characters contained is the length of the string. A string with a length of zero is called an empty string, and it does not contain any characters.

  • Storage method:

    ① Order storage: use one Group address consecutive memory cells to store string-valued character sequences. 

    ②Chain storage: Each node can store one character or multiple characters. At this time, the storage density should be considered.

Three, contrast memory

Some of these concepts can be compared The memory is completed, and there are some core knowledge that can be learned by comparison. This is the learning method provided to everyone. This is a very good idea, deep in memory, and can also improve one’s level.

Four. Summary

In this way, through continuous attacks, the time has finally come to reap the results. The data structure is to abstract your own things. By controlling this country, the editor keeps on completing it like this. Come on! !
The next editor will bring you “[Data Structure] Data Structure and Algorithm (1)-Nonlinear Structure”

Write picture description here

Write the picture description here

write picture description here

Leave a Comment

Your email address will not be published.