#includeusing namespace std;template class LinearList{ public: LinearList(int MaxListSize = 10); ~LinearList() {delete [] element;} bool IsEmpty() const { return length == 0;} int Length() const { return length;} bool Find(int k, T& x) const; int Search(const T& x) const; LinearList & Delete(int k, T& x); LinearList & Insert(int k, const T& x); void Output(ostream& out)const; private: int length; int MaxSize; T *element;};//超出内存class NoMem{ public: NoMem(){}};void my_new_handler(){ throw NoMem();};class OutOfBounds{ public: OutOfBounds(){}};template LinearList ::LinearList(int MaxListSize){ MaxSize = MaxListSize; element = new T[MaxSize]; length = 0;};template bool LinearList ::Find(int k, T& x)const{ if(k<1 || k>length) return false; x = element[k-1]; return true;};template int LinearList ::Search(const T& x)const{ for(int i=0; i < length ; i++) if(element[i]==x) return ++i; return 0;};template LinearList & LinearList ::Delete(int k, T& x){ if(Find(k,x)){ for(int i=k; i LinearList & LinearList ::Insert(int k, const T& x){ if(k<0 || k>length) throw OutOfBounds(); if(length == MaxSize) throw NoMem(); for(int i= length-1;i>=k;i--) element[i+1]=element[i]; element[k] = x; length ++; return *this;};template void LinearList ::Output(ostream& out)const{ for(int i=0;i ostream& operator<<(ostream& out, const LinearList & x){ x.Output(out); return out;};int main(){ try{ LinearList L(5); cout<<"Length = "< <