The basic operations of a linear table are defined as follows:
Public interface IListDS <T>
{
Int GetLength ();
Void Clear ();
Bool IsEmpty ();
Void Append (T item );
Void Insert (T item, int I );
T Delete (int I );
T GetElem (int I );
Int Locate (T value );
Void Reverse ();
Void Print ();
}
(1) sequence table definition: each element of a linear table is stored in a continuous space in the memory. In C #, the storage space occupied by arrays in the memory is a set of continuous storage areas with Random storage features. Logically adjacent data elements are physically adjacent. The code is implemented as follows:
Public class SeqList <T>: IListDS <T>
{
Private int maxSize;
Private T [] data;
Private int last;
Public T this [int index]
{
Get {return data [index];}
Set {data [index] = value ;}
}
Public int Last
{
Set {last = value ;}
Get {return last ;}
}
Public int MaxSize
{
Set {maxSize = value ;}
Get {return maxSize ;}
}
& N