当前位置:网站首页>Static linked list
Static linked list
2022-07-23 11:59:00 【Look, that's a licking dog】
#include <stdio.h>
#define MAXSIZE 20
typedef int T;
typedef struct
{
T data;
int cur;
}StaticList[MAXSIZE];
int LengthList(StaticList L)// The number of data
{
int i = 0;
int j = L[MAXSIZE - 1].cur;
while (i)
{
i = L[i].cur;
j++;
}
return j;
}
bool InitStList(StaticList space)
{
for (int i = 0; i < MAXSIZE; i++)
space[i].cur = i + 1;
space[MAXSIZE - 1].cur = 0;
return true;
}
int Malloc(StaticList space)// If the spare space linked list is not empty , Then the allocated node subscript is returned
{
int i = space[0].cur;
if (space[0].cur)
space[0].cur = space[i].cur;
return i;
}
void Free(StaticList space, int k)// Mark the subscript as k The idle nodes are recycled to the spare list
{
space[k].cur = space[0].cur;
space[0].cur = k;
}
bool InterList(StaticList L, int i,T val)// stay L pass the civil examinations i Insert a new data element before an element
{
int j, k, l;
T e;
k = MAXSIZE - 1;
if (i<i || i>LengthList(L) + 1)
return false;
j = Malloc(L);
if (j)
{
L[j].data = val;
for (l = 1; l <= i - 1; l++)
k = L[k].cur;
L[j].cur = L[k].cur;
L[k].cur = j;
return true;
}
return false;
}
void Show(StaticList L)// Traverse
{
int i = L[MAXSIZE - 1].cur;
while (i)
{
printf("%d ", L[i].data);
i = L[i].cur;
}
printf("\n");
}
bool DeleteList(StaticList L, int i)// Delete on L No i Data element
{
int j, k;
if (i<1 || i>LengthList(L))
return false;
k = MAXSIZE - 1;
for (j = 1; j <= i - 1; j++)
k = L[k].cur;
j = L[k].cur;
L[k].cur = L[j].cur;
Free(L, j);
return true;
}
int main()
{
return 0;
}
Give a link , You can see for yourself what you want to know
边栏推荐
- [metric] use Prometheus to monitor flink1.13org.apache.flink.metrics
- 對.h5文件的迭代顯示,h5py數據操作
- Modify the root password of MySQL
- 3.1、对DQL简化补充
- VMware uses wireless network card NAT to access the Internet under Windows
- Data warehouse 4.0 notes - user behavior data collection II
- [uiautomation] key instructions (and three call methods) + common mouse actions +sendkeys+inspect learning
- DBA命令
- 静态链表
- MySQL view
猜你喜欢

飞桨高层API实现图像去雨

11. Multithreading

Internet communication

使用飞桨实现肺部 CT 扫描的 3D 图像分类

NFT digital collection system development: Xu Beihong Art Museum unveiled through the digital collection platform

ChaosLibrary·UE4开坑笔记

MySQL存储引擎

数仓4.0笔记——用户行为数据采集二

對.h5文件的迭代顯示,h5py數據操作

Data warehouse 4.0 notes - business data collection
随机推荐
MySQL sorts by Chinese field initials
The user logs in continuously (interruption is allowed) to query SQL
Wordcount of the first Flink program
MySQL transaction rollback mechanism and principle
Es operation command
Unable to negotiate with port 51732: no matching host key type found. Their offer:
Data warehouse 4.0 notes - user behavior data collection IV
Understanding of the decoder in the transformer in NLP
[untitled]
Yarn capacity scheduler settings
Standardize database design
Affichage itératif des fichiers.h5, opérations de données h5py
使用飞桨实现肺部 CT 扫描的 3D 图像分类
LearnOpenGL - Introduction
Accordion effect
MySQL user management
数仓4.0笔记——用户行为数据采集四
Stage 1 Review
静态链表
规范数据库设计