#include
#include
#define error 0
#define ok 1
#define equal 1
#define overflow -1
#define list_init_size 100
#define listincrement 10
struct stustu[50];
typedef struct stu elemtype;
struct lnode
;typedef struct lnode lnode;
typedef struct lnode *linklist;
int init(linklist *l)
/*init */
int listlength(linklist l)
return j;
}int getelem(linklist l,int i,elemtype *e)
if(!p||j>1) return error;
*e=p->data;
return ok;
}int equallist(elemtype *e1,elemtype *e2)
int less_equallist(elemtype *e1,elemtype *e2)
int deleteelem(linklist l,int i)
if(!p) return error;
q->next=p->next;
return ok;
}elemtype* priorelem(linklist l,elemtype e)
return null;
}
int locateelem(linklist la,elemtype e,int type)
return 0;
break;
default:
break;
}return 0;
}void mergelist(linklist la,linklist lb,linklist *lc)
else
}pc->next=pa?pa:pb;
free(lb);
}int printlist(linklist l)
printf("/n");
}int listinsert(linklist l,int i,elemtype e)
if(!p||j>i-1) return error;
s=(linklist)malloc(sizeof(lnode));
s->data=e;
s->next=p->next;
p->next=s;
return ok;
}/*listinsert before i */
int main()
C 語言實現線性表之鍊錶例項
插入 刪除結點的 有點多,但這樣提高了 的可讀性,且不增加時間複雜度,不會影響程式效能 include using namespace std template class clist template class node template class clist 為頭結點分配空間 templat...
資料結構C語言實現 線性鍊錶
declaration.h ifndef declaration h included define declaration h included define true 1 define false 0 define ok 1 define error 0 define infeasible 1 ...
線性表c語言實現
lineartable.h pragma once 線性表的實現 define maxsize 20 define ok 1 define error 2 typedef struct list list t 線性表初始化 void initlist list t list 根據下表查詢資料 int...