Fxxking dataStructure

编程入门 行业动态 更新时间:2024-10-11 19:16:35

Fxxking <a href=https://www.elefans.com/category/jswz/34/1633475.html style=dataStructure"/>

Fxxking dataStructure



#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define OVERFLOW -1
#define LIST_INIT_SIZE 100 //初始表空间大小
#define LISTINCREMENT 10 //表长增量
typedef int Status; 
typedef char ElemType; 
using namespace std;


typedef struct{
ElemType *elem; 
int length; 
int listsize; 
}SqList;
 
SqList La,Lb,Lc,Ld; 
 
/**构造一个空的线性表L**/
Status InitList_Sq(SqList &L)
{
//L.elem = new ElemType;
L.elem = (ElemType *)malloc(LIST_INIT_SIZE * sizeof(ElemType));
if(!L.elem) exit(OVERFLOW); 
L.length = 0; 
L.listsize = LIST_INIT_SIZE; 
return OK;

/*插入新元素e*/
Status ListInsert_Sq(SqList &L,int i,ElemType e)
{
ElemType *newbase,*p,*q;
if(i < 1 || i > L.length + 1) return ERROR;
if(L.length >= L.listsize){ 
newbase = (ElemType *)realloc(L.elem,(L.listsize + LISTINCREMENT) * sizeof(ElemType));
if(!newbase) exit(OVERFLOW); 
L.elem = newbase; 
L.listsize += LISTINCREMENT; 
}

更多推荐

Fxxking dataStructure

本文发布于:2024-03-10 06:38:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1727252.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Fxxking   dataStructure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!