有序线性表的插入与删除
#include<iostream>
#include<stdlib.h>
# define LIST_INIT_SIZE 100
# define LISTINCREMENT 10
# define ElemType int
# define OVERFLOW -1
# define ERROR -1
using namespace std;
typedef struct {
ElemType *elem;
int length;
int listsize;
}SqList;
void InitList_Sq(SqList &L)
{
L.elem = (ElemType * )malloc(LIST_INIT_SIZE*sizeof(ElemType));
if(! L.elem)
exit(OVERFLOW);
L.length = 0;
L.listsize = LIST_INIT_SIZE;
}
int ListInsert_Sq(SqList &L, int i, ElemType e)
{
if(i > L.length)
{
cout << "ERROR";

本文深入探讨了有序线性表的基本概念,详细解析了如何进行有效插入和删除操作,确保数据结构的有序性。内容涵盖操作算法及其实现策略,帮助读者掌握有序线性表维护的技巧。
最低0.47元/天 解锁文章
4982

被折叠的 条评论
为什么被折叠?



