91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

華中科技大學_實驗報告_基于鏈式存儲結構實現線性表的基本運算

資源截圖

代碼片段和文件信息

#include?
#include?
#include?

/*---------page?10?on?textbook?---------*/
#define?TRUE?1
#define?FALSE?0
#define?OK?1
#define?ERROR?0
#define?INFEASTABLE?-1
#define?OVERFLOW?-2
typedef?int?status;
typedef?int?ElemType;?//數據元素類型定義
/*-------page?22?on?textbook?-------*/
#define?LIST_INIT_SIZE?100
#define?LISTINCREMENT??10

typedef?struct?ListNode?{??//順序表(順序結構)的定義
ElemType?data;
struct?ListNode?*next;
}ListNode*pListNode;
int?e;
ListNode?L;
pListNode?pL?=?&L;
status?IntiaList(pListNode?&Lp)?{
Lp?=?(pListNode)malloc(sizeof(ListNode));
Lp->data?=?0;
Lp->next?=?NULL;
?pL?=?Lp;
return?OK;
}
status?DestroyList(pListNode?&Lp)?{
if?(!Lp)return?ERROR;
Lp->data?=?0;
if?(Lp->next?==?NULL)
{
free(Lp->next);
free(Lp);
}
else
{
DestroyList(Lp->next);
Lp->next?=?NULL;
free(Lp);
}
return?OK;
}
status?ClearList(pListNode?&Lp)?{
if?(!Lp)return?ERROR;
Lp->data?=?0;
if?(Lp->next?==?NULL)
{
free(Lp);
}
else
{
ClearList(Lp->next);
free(Lp);
}
return?OK;
}
status?ListEmpty(ListNode?L)?{
if?(L.data?==?0)
return?TRUE;
else
return?FALSE;
}
int?ListLength(ListNode?L)?{
return?L.data;
}
status?GetElem(ListNode?L?int?i?ElemType?*e)?{
if?(i<1?||?i>L.data)
return?ERROR;
pListNode?p?=?L.next;
while?(--i)
{
p?=?p->next;
}
(*e)?=?p->data;
return?OK;
}
status?compare(ElemType?e?ElemType?f)
{
if?(f?==?e)return?TRUE;
else?return?FALSE;
}
status?LocateElem(ListNode?L?ElemType?e?status(*comparep)(ElemType?e?ElemType?f))
{
if?(L.next?==?NULL)
return?ERROR;
pListNode?p?=?L.next;
int?i?=?1;
while?(p)
{
if?((*comparep)(e?p->data))
return?i;
else
{
i++;
p?=?p->next;
}
}
return?0;
}
status?PriorElem(ListNode?L?ElemType?cur_e?ElemType*?pre_e)
{
if?(L.data?==?0)
return?ERROR;
if?(L.next->data?==?cur_e)
return?ERROR;
pListNode?pri_p?=?L.next?cur_p?=?L.next->next;
while?((cur_p->data?!=?cur_e)?&&?cur_p)
{
pri_p?=?cur_p;
cur_p?=?cur_p->next;
}
if?(cur_p->data?==?cur_e)
{
*pre_e?=?pri_p->data;
return?OK;
}
else?return?ERROR;
}
status?NextElem(ListNode?L?ElemType?cur_e?ElemType*?next_e)
{
if?(L.next?==?0)
return?ERROR;
pListNode?p?=?L.next;
while?(p->data?!=?cur_e?&&?p->next)
p?=?p->next;
if?(!(p->next))return?ERROR;
else?//if(p->data?==?cur_e)
{
*next_e?=?p->next->data;
return?OK;
}
}
status?ListInsert(pListNode?Lp?int?i?ElemType?e)?{
if?(i<1?||?i>Lp->data?+?1)
return?ERROR;
pListNode?p?=?(pListNode)malloc(sizeof(ListNode));
if?(Lp->data?==?0)?{
Lp->next?=?p;
p->data?=?e;
p->next?=?NULL;
Lp->data?=?1;
return?OK;
}
pListNode?p1?=?Lp->next;
while?(p1->next)p1?=?p1->next;
p1->next?=?p;
p->data?=?e;
p->next?=?NULL;
Lp->data++;
return?OK;
}
status?ListDelete(pListNode?Lp?int?i?ElemType*?e)
{
if?(Lp->data)
{
if?(i<1?||?i>Lp->data)
return?ERROR;
p

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1118??2016-05-28?23:13??2?基于鏈式存儲結構實現線性表的基本運算\Makefile.win
?????文件????????7879??2016-06-12?00:42??2?基于鏈式存儲結構實現線性表的基本運算\main.cpp
?????文件??????138486??2016-06-12?00:53??2?基于鏈式存儲結構實現線性表的基本運算\main.exe
?????文件????????9596??2016-05-28?23:13??2?基于鏈式存儲結構實現線性表的基本運算\main.o
?????文件?????????960??2016-05-28?23:09??2?基于鏈式存儲結構實現線性表的基本運算\基于鏈式存儲結構實現線性表的基本運算.dev
?????文件??????138486??2016-05-28?23:13??2?基于鏈式存儲結構實現線性表的基本運算\基于鏈式存儲結構實現線性表的基本運算.exe
?????文件??????????97??2016-05-28?23:14??2?基于鏈式存儲結構實現線性表的基本運算\基于鏈式存儲結構實現線性表的基本運算.layout
?????目錄???????????0??2016-06-12?00:53??2?基于鏈式存儲結構實現線性表的基本運算\

評論

共有 條評論