#include <iostream>
using namespace std;
#define MAX 100
typedef struct staticlist
{
int data;
int next;
}STATIC_LIST[MAX];
void create_list(STATIC_LIST space)
{
for(int i=0; i<MAX-1; i++)
{
space[i].next = i+1;
}
space[MAX-1].next = 0;
}
int new_ssl(STATIC_LIST space)
{
int i=space[0].next;
if(space[0].next)
{
space[0].next = space[i].next;
}
return i;
}
bool insert_list(STATIC_LIST space, int e,int loaction) //前插
{
int j = new_ssl(space);
int k = MAX-1;
if(j)
{
space[j].next = e;
for(int i=0; i<loaction;i++)
{
k = space[k].next; //k是 插入节点的前面节点地址
}
space[j].next = space[k].next;
space[k].next = j;
return true;
}
return false;
}
void free_ssl(STATIC_LIST space, int a)
{
space[a].next = space[0].next;
space[0].next = a;
}
bool delete_list(STATIC_LIST space, int i)
{
int k = MAX-1;
int m;
for(int j=0; j<i ;j++)
{
k=space[k].next;
}
m = space[k].next; // delete a 为要删除的位置
space[k].next = space[m].next;
free_ssl(space, m);
return true;
}
int list_size(STATIC_LIST space)
{
int i=0;
int j =space[MAX-1].next;
while(j)
{
i++;
j=space[j].next;
}
return i;
}
int find_list(STATIC_LIST space, int data)
{
int i=0;
int j=space[MAX-1].next;
while(j)
{
if(data = space[j].data)
{
return j;
}
j=space[j].next;
}
return 0;
}
bool list_empty(STATIC_LIST space)
{
if( 0==space[MAX-1].next)
{
return true;
}
return false;
}
void travel_print(STATIC_LIST space)
{
int i=0;
int j =space[MAX-1].next;
while(j)
{
i++;
cout<<"第"<<i<<"个结点为:"<<space[j].data;
j = space[j].next;
}
}
int main()
{
return 0;
}