数据结构删除程序
来源:互联网 发布:nagios 监控windows 编辑:程序博客网 时间:2024/06/06 00:24
#include <stdio.h>
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef int ElemType;
typedef struct
{
ElemType *elem;
int length;
int listsize;
}SqList;
typedef int Status;
Status 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;
return OK;
}
Status ListInsert_Sq(SqList &L,int i,ElemType e)
{
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(OBERFLOW);
L.elem = newbase;
L.listsize += LISTINCREMENT;
}
for (k=L.length;k>=i;k--)
L.elem[k-1]=L.elem[k-2];
L.elem[i-1]=e;
++L.length;
return OK;
}
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef int ElemType;
typedef struct
{
ElemType *elem;
int length;
int listsize;
}SqList;
typedef int Status;
Status 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;
return OK;
}
Status ListInsert_Sq(SqList &L,int i,ElemType e)
{
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(OBERFLOW);
L.elem = newbase;
L.listsize += LISTINCREMENT;
}
for (k=L.length;k>=i;k--)
L.elem[k-1]=L.elem[k-2];
L.elem[i-1]=e;
++L.length;
return OK;
}
- 数据结构删除程序
- 数据结构 线性表中删除某一元素的程序
- 数据结构:程序加图示分析单链表的插入和删除操作
- 数据结构——栈的构造、插入、删除、读取操作程序
- 数据结构的删除操作
- 【数据结构】二叉排序树的删除
- 数据结构-单链表按值删除
- 数据结构-双链表删除
- 数据程序 删除程序
- 数据结构 链表的删除
- 数据结构 单链表的删除操作
- 数据结构--删除单链表中重复元素
- 数据结构 -- 单链表之删除节点
- 数据结构中链表元素的删除
- 数据结构单链表的建立、删除
- 数据结构 单链表删除结点 例子
- 数据结构-单链表按序号删除
- 数据结构-单链表节点的删除
- 2013 长沙网络赛 B 题 Bizarre Routine
- 新浪微博技术架构分析-转载
- mac bash shell下的javac命令乱码
- Google面试题之战胜股市
- Could not initialize the application's security component
- 数据结构删除程序
- JSON
- 有些事情,真的没有你想的那么难
- 在 jsp 中提交 form 表单到action ; 无刷新上传; 注意和servlet 上传区别;
- 看到一个很好玩的代码显示~~~~来瞄瞄
- BAT 批处理脚本 教程
- 理解 JVM 如何使用 Windows 和 Linux 上的本机内存
- LCA(最近公共祖先)
- 编辑距离,最长公共子序列,最长公共子串,最长递增子序列