1. The stack operation is a linear table defined at the end of the table. The table end must be inserted or deleted. We call the end of the table the top of the stack, and the other end the bottom of the stack. Stack operations follow the following steps: LIFO: Last
In First Out) or advanced post-output (FILO) principle, so it is also called LIFO table or FILO table.
2. Several common stack operations are represented as follows using interfaces:
Public interface IStack <T> {int GetLength (); bool IsEmpty (); void Clear (); void Push (T item); // T Pop (); // output stack T GetTop ()
} 3. using continuous space to store the elements in the stack is called the sequential stack. we implement a simple ordered stack. The Code is as follows: public class SeqStack <T>: IStack <T> {private int maxsize; private T [] data; private int top; public T this [int index] {get {return data [index];} set {data [index] = value ;}} public int Maxsize {get {return maxsize ;}set {maxsize = value ;}} public int Top {get {return top ;} set {top = value ;}} public SeqStack (int size) {data = new T [size]; maxsize = size; top =-1;} public int GetLength () {return top + 1;} public void Clear () {top =-1;} public bool IsEmpty (){