Stacks are linear tables that are limited by operations to the end of a table. The end of the table is to be inserted, deleted, and so on, so it has a special meaning, the end of the table is called the top, the other end is fixed, called the Stack Bottom (Bottom).
Stack rather than washing dishes in life, put the washed dishes up one by one (equivalent to putting the elements into the stack), and taking the plate, take the top down one after the other (equivalent to putting the elements out of the stack).
The following is the interface of the stack:
(IDs is a public interface for a variety of data structures, contains count (), IsEmpty (), clear () Three operations, previous sequential tables have been defined)
using System;
using System.Collections.Generic;
using System.Text;
namespace DateStructrues
{
/// <summary>
/// 栈接口
/// </summary>
/// <typeparam name="T">泛型</typeparam>
public interface IStack<T> : IDS<T>
{
/// <summary>
/// 入栈操作
/// </summary>
/// <param name="item">泛型:要入栈的元素</param>
void Push(T item);
/// <summary>
/// 出栈操作
/// </summary>
/// <returns>出栈的元素</returns>
T Pop();
/// <summary>
/// 取栈顶元素
/// </summary>
/// <returns>取出的元素</returns>
T GetTop();
}
}