-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinkStack.h
88 lines (74 loc) · 2 KB
/
LinkStack.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// Created by Maylon on 2022/8/12.
//
#include "Stack.h"
#ifndef DATA_STRUCTURES_LINKSTACK_H
#define DATA_STRUCTURES_LINKSTACK_H
typedef struct LinkStackNode {
ElemType data;
struct LinkStackNode *next;
} LinkStackNode, *LinkStack;
/* Create */
/*!
* Initialize or reset the linked stack (without a head)
* @param S : pointer to the linked stack
*/
void InitLinkStack(LinkStack *S);
/* Destroy */
/*!
* Destroy the linked stack (without a head)
* @param S : pointer to the linked stack
* @return status (true, false)
*/
Status DestroyLinkStack(LinkStack *S);
/* Push */
/*!
* Push an element into the linked stack (without a head)
* @param S : pointer to the linked stack
* @param e : the data to be pushed
* @return status (true, false)
*/
Status LinkStack_Push(LinkStack *S, ElemType e);
/* Pop */
/*!
* Pop an element out of the linked stack (without a head)
* @param S : pointer to the linked stack
* @param e : pointer to the data to be popped
* @return status (true, false)
*/
Status LinkStack_Pop(LinkStack *S, ElemType *e);
/* Retrieve */
/*!
* Get the top data of the linked stack (without a head)
* @param S : the linked stack
* @param e : pointer to the top data
*/
void LinkStack_Get_Top(LinkStack S, ElemType *e);
/*!
* Judge if the linked stack (without a head) is empty
* @param S : the linked stack
* @return status (true, false)
*/
Status LinkStack_Empty(LinkStack S);
/*!
* Get the length of the linked stack (without a head)
* @param S : the linked stack
* @return length of the stack
*/
int LinkStack_Len(LinkStack S);
/* Traverse */
/*!
* Traverse the linked stack (without a head)
* @param S : the linked stack
* @param visit : function pointer to the function that prints the data of a node
*/
void LinkStack_Traverse(LinkStack S, void(*visit)(ElemType e));
/*!
* The linked stack (without a head) menu
*/
void linkstack_menu(void);
/*!
* The linked stack (without a head) menu details
*/
void linkstack_menu_show_details(void);
#endif //DATA_STRUCTURES_LINKSTACK_H