These days you need to implement a variety of data structures (generics). The main implementation of the linear table and linked list.
A linear table is a finite sequence consisting of n (n>=0) data elements of the same type. Except for the first element, the remaining elements have only one direct precursor; except for the last element, the remaining elements have only one direct successor.
A sequential table is a space in which the elements of a table are placed one after the other in a fast address, so the implementation of the sequential table is done with an array.
Because of the need to implement a variety of data structures, all kinds of data structures have the same method, such as the length of the request, empty and so on. So define a common interface:
namespace DateStructrues
{
public interface IDS<T>
{
int Count { get;} //求长度
void Clear(); //清空操作
bool IsEmpty{get;} //判断线性表是否为空
}
}
Linear Table Interface:
namespace DateStructrues.Lists
{
interface IListDS<T> : IDS<T>
{
void Append(T item); //附加操作
void Insert(T item, int index); //插入操作
T Delete(int index); //删除操作
T GetElement(int index); //取表元
int Locate(T value); //按值查找
}
}