summaryrefslogtreecommitdiff
path: root/c/dataStructure/线性表/线性链表/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/dataStructure/线性表/线性链表/list.h')
-rwxr-xr-xc/dataStructure/线性表/线性链表/list.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/c/dataStructure/线性表/线性链表/list.h b/c/dataStructure/线性表/线性链表/list.h
new file mode 100755
index 0000000..1b0e8b0
--- /dev/null
+++ b/c/dataStructure/线性表/线性链表/list.h
@@ -0,0 +1,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 \ No newline at end of file