当前位置:网站首页>串的初步认识
串的初步认识
2022-07-23 13:47:00 【夜深人静码代码】
一、串的相关概念
1、串的定义:零个或多个任意字符组成的有限序列。
2、空串一般用∅表示。
3、串相等:当且仅当两个串的长度相等并且各个对应位置上的字符都相同时,这两个串才是相等的。所有空串是相等的。
4、串的类型定义:
ADT String {
数据对象:.......
数据关系:.......
基本操作:
(1) StrAssign (&T,chars) //串赋值
(2) StrCompare (S,T) //串比较
(3) StrLength (S) //求串长
(4) Concat(&T,S1,S2) //串连接
(5) SubString(&Sub,S,pos,len) //求子串
(6) StrCopy(&T,S) //串拷贝
(7) StrEmpty(S) //串判空
(8) ClearString (&S) //清空串
(9) Index(S,T,pos) //子串的位置
(11) Replace(&S,T,V) //串替换
(12) Strlnsert(&S,pos,T) //子串插入
(12) StrDelete(&S,pos,len) //子串删除
(13) DestroyString(&S) //串销毁
}ADT String
二、串的存储结构
1、串的链式存储结构——块链结构
#define CHUNKSIZE 80 //块的大小可由用户定义
typedef struct Chunk{
char ch[CHUNKSIZE];
struct Chunk *next;
}Chunk;
typedef struct{
Chunk *head,*tail; //串的头指针和尾指针
int curlen; //串的当前长度
}LString; //字符串的块链结构2、串的顺序存储结构
#define MAXLEN 255
typedef struct{
char ch[MAXLEN+1]; //存储串的一维数组
int length; //串的当前长度长度
}SString;边栏推荐
- TS encapsulates the localstorage class to store information
- Direct exchange
- 移动、电信、联通:5G To B的花式解法
- PMP practice once a day | don't get lost in the exam -7.23
- 智慧物联网源码 带组态物联网源码 工业物联网源码:支持传感器解析服务,数据实时采集和远程控制
- 网络协议与攻击模拟:wireshark使用、ARP协议
- TOPSIS法(MATLAB)
- Weisfeiler-Lehman图同构测试及其他
- 微信小程序wx.hideLoading()会关闭toast提示框
- 【31. 走迷宫(BFS)】
猜你喜欢

Tips and tricks for Neural Networks 深度学习训练神经网络的技巧总结(不定期更新)

Detector: detect objects with recursive feature pyramid and switchable atolos convolution

解决data functions should return an object 并(Property “visible“ must be accessed with “$data.visible“)

一道反序列化的CTF题分享

Using "soup.h1.text" crawler to extract the title will be one more\

AutoCAD进阶操作

Wechat applet wx.hideloading() will close the toast prompt box

国内生产总值(GDP)数据可视化

Surface family purchase reference

【Flutter -- 布局】线性布局(Row 和 Column)
随机推荐
系统内存介绍和内存管理
距离IoU损失:包围盒回归更快更好的学习(Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression)
CSR、SSR 与 SSG
C语言基础篇 —— 2-5 指针与函数知识点
MATLAB基础
层次分析法(MATLAB)
anchor free yolov1
基于APISIX的basic-auth插件对Minio文件上传功能进行授权
IDEA中给项目添加依赖的jar包
SSD: Single Shot MultiBox Detector
Wechat applet class binding, how to bind two variables
Scale Match for Tiny Person Detection
NodeJs实现token登录注册(KOA2)
Nifi 1.16.3 cluster setup +kerberos+ user authentication
Bag of tricks for image classification "with convolutional neural networks"
【30. n-皇后问题】
Fundamentals of C language -- the data type meaning of 2-4 pointers and the analysis of forced type conversion
Summary of after class homework of Microcomputer Principle and technical interface
【无标题】
Detector: detect objects with recursive feature pyramid and switchable atolos convolution