如何用C++实现顺序表?

来源:百度知道 编辑:UC知道 时间:2024/06/03 17:36:27

/**//*
Length = 0
IsEmpty = 1
List is 2 6
IsEmpty = 0
First element is 2
Length = 2
Deleted element is 2
List is 6
*/

#include <iostream>
#include <new>
using namespace std;

class NoMem ...{
public:
NoMem() ...{}
};

void my_new_handler()
...{
throw NoMem();
};

new_handler Old_Handler_ = set_new_handler(my_new_handler);

class OutOfBounds ...{
public:
OutOfBounds() ...{}
};

template<class T>
class LinearList...{
public:
LinearList(int MaxListSize = 30);
~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<