資源簡介
利用順序表的操作,實現以下函數:
(1)從順序表中刪除具有最小值的元素并由函數返回被刪元素的值,空出的位置由最后一個元素填補。
(2)從順序表中刪除具有給定值x的所有元素。
(3)從有序順序表中刪除其值在給定值s與t之間(s<t)的所有元素,
代碼片段和文件信息
#include
using?namespace?std;
class?ArrayList
{
public:
ArrayList(const?int?size)
{
???? maxSize=size;
arrayList=new?int[maxSize];
????curLen=size;
position=0;
}
????~ArrayList()
{
delete?[]?arrayList;
}
???????void?clear()
???{
???delete?[]arrayList;
???curLen=0;
???position=0;
???arrayList=new?int[maxSize];
???}
???bool?ListEmpty()const
???{
???return?curLen==0;
???}
???int?Length()const
???{
???return?curLen;
???}
???void?show()
???{
????? ?for(int?i=0;i ?{
?cout< ?cout<<“\t“;
?}
?cout< ???}
???????int&?operator[](int?i)const;
???????int?DelMin();
???void?DelValue(const?int?value);
???void?Del_stot(const?int?sconst?int?t);
???private:
??
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-10-09?22:27??第2題\
?????目錄???????????0??2014-10-09?22:27??第2題\Debug\
?????文件??????255765??2014-09-25?10:21??第2題\Debug\t2.obj
?????文件???????74752??2014-09-25?10:21??第2題\Debug\vc60.idb
?????文件??????110592??2014-09-25?10:21??第2題\Debug\vc60.pdb
?????文件??????548920??2014-09-25?10:21??第2題\Debug\第2題.exe
?????文件??????787932??2014-09-25?10:21??第2題\Debug\第2題.ilk
?????文件?????2001156??2014-09-25?10:17??第2題\Debug\第2題.pch
?????文件?????1098752??2014-09-25?10:21??第2題\Debug\第2題.pdb
?????文件????????2582??2014-09-25?10:22??第2題\t2.cpp
?????文件????????4269??2014-09-25?13:24??第2題\第2題.dsp
?????文件????????1267??2014-09-25?10:21??第2題\第2題.plg
評論
共有 條評論