-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeqStack.h
97 lines (81 loc) · 2.07 KB
/
SeqStack.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
89
90
91
92
93
94
95
96
97
//
// Created by Maylon on 2022/8/12.
//
#include "Stack.h"
#ifndef DATA_STRUCTURES_SEQSTACK_H
#define DATA_STRUCTURES_SEQSTACK_H
#define DeltaSize 5
typedef struct {
ElemType *data;
int top, MaxSize;
} SeqStack;
/* Create */
/*!
* Initialize or reset the sequential stack
* @param S : pointer to the sequential stack
* @return status (true, false)
*/
Status InitSeqStack(SeqStack *S);
/*!
* Increase capacity of the sequential stack when the stack is full
* @param S : pointer to the sequential stack
* @return status (true, false)
*/
Status SeqStack_Increase_Capacity(SeqStack *S);
/* Destroy */
/*!
* Destroy the sequential stack
* @param S : pointer to the sequential stack
*/
void DestroySeqStack(SeqStack *S);
/* Push */
/*!
* Push an element into the sequential stack
* @param S : pointer to the sequential stack
* @param e : the data to be pushed
* @return status (true, false)
*/
Status SeqStack_Push(SeqStack *S, ElemType e);
/* Pop */
/*!
* Pop an element out of the sequential stack
* @param S : pointer to the sequential stack
* @param e : pointer to the data to be popped
* @return status (true, false)
*/
Status SeqStack_Pop(SeqStack *S, ElemType *e);
/* Retrieve */
/*!
* Get the top data of the sequential stack
* @param S : the sequential stack
* @param e : pointer to the top data
*/
void SeqStack_Get_Top(SeqStack S, ElemType *e);
/*!
* Judge if the sequential stack is empty
* @param S : the sequential stack
* @return status (true, false)
*/
Status SeqStack_Empty(SeqStack S);
/*!
* Get the length of the sequential stack
* @param S : the sequential stack
* @return length of the stack
*/
int SeqStack_Len(SeqStack S);
/* Traverse */
/*!
* Traverse the sequential stack
* @param S : the sequential stack
* @param visit : function pointer to the function that prints the data of a node
*/
void SeqStack_Traverse(SeqStack S, void(*visit)(ElemType e));
/*!
* The sequential stack menu
*/
void seqstack_menu(void);
/*!
* The sequential stack menu details
*/
void seqstack_menu_show_details(void);
#endif //DATA_STRUCTURES_SEQSTACK_H