小结



顺序表
1.顺序存储:                
typedef struct                          
{
  Elemtype data[MaxSize];               
  int length;
}Sqlist;
实现:
void CreateList(Sqlist *&L,ElemType a[],int n);
void InitList(Sqlist *&L);
void DestroyList(Sqlist *&L);
bool ListEmpty(Sqlist *L);
int ListLength(Sqlist *L);
void DispList(Sqlist *L);
bool GetElem(Sqlist *L,int i,ElemType &e);
int LocateElem(Sqlist *L,ElemType e);
bool ListInsert(Sqlist *&L,int i,ElemType e);
bool ListDelete(Sqlist *&L,int i,ElemType &e);

2.链式存储:
<1>单链表
typedef struct LNode
{
  ElemType data;
  struct LNode *next;
}lingklist;
实现:
void CreateList(Sqlist *&L,ElemType a[],int n);
void InitList(Sqlist *&L);
void DestroyList(Sqlist *&L);
bool ListEmpty(Sqlist *L);
int ListLength(Sqlist *L);
void DispList(Sqlist *L);
bool GetElem(Sqlist *L,int i,ElemType &e);
int LocateElem(Sqlist *L,ElemType e);
bool ListInsert(Sqlist *&L,int i,ElemType e);
bool ListDelete(Sqlist *&L,int i,ElemType &e);
<2>.双链表
typedef struct DNode
{
  ElemType data;
  struct DNode *prior;
  struct DNode *next;
}Dlinklist;
实现:
void CreateList(DLinklist *&L,ElemType a[].int n);
bool ListInsert(DLinklist *&L,int i,ElemType e);
bool ListDelete(DLinklist *&L,int i,ElemType &e);



1.顺序存储:
typedef struct
{
  ElemType data[MaxSize];
  int top;
}Sqstack;
实现:
void InitStack(SqStack *&s);
void DestroyStack(SqStack *&s);
bool StackEmpty(SqStack *s);
bool Push(SqStack *&s,ElemType e);
bool Pop(SqStack *&s,ElemType &e);
bool GetTop(SqStack *s,ElemType &e);
2.链式存储:
typedef struct linknode
{
  ElemType data;
  struct linknode *next;
}LiStack;
实现:
void InitStack(SqStack *&s);
void DestroyStack(SqStack *&s);
bool StackEmpty(SqStack *s);
bool Push(SqStack *&s,ElemType e);
bool Pop(SqStack *&s,ElemType &e);
bool GetTop(SqStack *s,ElemType &e);


队列
1.顺序存储:
typedef struct
{
  ElemType data[MaxSize];
  int front,rear;
}SqQueue;
实现:
void InitQueue(SqQueue *&q);
void DestroyQueue(SqQueue *&q);
bool enQueue(SqQueue *&q,ElemType e);
bool deQueue(SqQueue *&q,ElemType &e);
2.链式存储:
typedef struct qnode
{
  ElemType data;
  struct qnode *next;
}QNode;
实现:
void InitQueue(SqQueue *&q);
void DestroyQueue(SqQueue *&q);
bool enQueue(SqQueue *&q,ElemType e);
bool deQueue(SqQueue *&q,ElemType &e);

你可能感兴趣的:(小结)