Data Structure - Chapter 4 (1) - String

data structure


⚡️Data Structures-Chapter 1
⚡️Abstract Data Type Case
⚡️Data Structures-Chapter 2(1)-Linear Structures
⚡️Data Structures-Chapter 2(2)-Sequential Representation and Implementation of Linear Tables
⚡️Data Structures-Chapter 2 (3) - Sequence table (with code)
⚡️ Data structure - Chapter 2 (4) - Case of sequence table (with code)
⚡️ Data structure - Chapter 2 (5) - Chained storage structure
⚡️ Data structure - Chapter 2 (6) - Implementation of basic operations of singly linked list
⚡️ Data structure - Chapter 2 (7) - Doubly linked list and circular linked list

insert image description here

string

 &ems; Earlier, we said that stacks and queues are linear lists with limited operations. Here we call strings a linear list with limited content. Why? Because strings can only operate on characters.

string definition

  • A string is a finite sequence of zero or more arbitrary characters, also known as a string.

insert image description here
string of several terms

insert image description here

  • Substring: A subsequence (including an empty string) consisting of any number of consecutive characters in the string is called a substring of the string

  • Main string: A string containing a substring is called a main string accordingly

  • Character position: the sequence number of the character in the sequence is the position of the character in the string

  • Substring position: The position of the first character of the substring in the main string

  • Space string: A string consisting of one or more spaces. Different from an empty string, a space string has content and length and consists only of spaces.

insert image description here

  • Strings are equal: Two strings are equal if and only if the lengths of the two strings are equal and the characters in each corresponding position are the same

  • all empty strings are equal

  • The application of strings is very extensive. Most of the non-numerical processing objects of the computer are mostly string data, such as: text editing, symbol processing, various information systems, etc.
    insert image description here

Case introduction

insert image description here
insert image description here

String type definition, storage structure and operation

  The linear table is more concerned with the operations of a single element, such as finding an element, inserting or deleting an element, but the string is more about finding the position of the substring, getting the substring at the specified position, and replacing the substring.
insert image description here
insert image description here

insert image description here

String sequential storage structure

insert image description here

Chained storage structure of strings

insert image description here

insert image description here
insert image description here
  Strings are rarely added and deleted, so sequence structures are often used for matching and search operations.

Guess you like

Origin blog.csdn.net/CltCj/article/details/122693028