blob: 1b0e8b0c5eacf18c67e86457548c5ec3d5a20006 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#ifndef _LIST_H
#define _LIST_H
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#include<string.h>
typedef int ElemType;
typedef struct list {
ElemType data;
struct list * next;
}LNode;
typedef LNode * List;
void InitList (List * L);
void DestroyList (List * L);
bool AddElem (List * L, ElemType e); // Add an element, length +1
bool ListEmpty (List * L);
int ListLength (List * L);
ElemType GetElem (List * L, int i); // Get ith element
int LocateElem (List * L, ElemType e); // return element e's position, if not found, return 0
ElemType PriorElem (List * L, ElemType e); // return precedent element of e
ElemType NextElem (List * L, ElemType e); // return element after e
bool InsertElem (List * L, ElemType e, int i); // insert Elem at i
bool DeleteElem (List * L, int i); // delete ith element
void TraverseList (List * L); // traverse all list
void OperateMenu (void); // show Menu to user
#endif
|