Finish ArrayList Class C++ Finish the implementation of the ArrayList class by c
ID: 643163 • Letter: F
Question
Finish ArrayList Class C++
Finish the implementation of the ArrayList class by creating the definition of the FindKth and Delete member functions. and enhance the implementation of the list by implementing the following function:
int Replace( double a, double b );
The function will replace all the occurrences of a by b in the list x. It will return a count of the number of replacements.
________________________________________________________________________________
Arraylist.h
Explanation / Answer
#include "ArrayList.h";
#include <iostream>;
using namespace std;
ArrayList :: ArrayList()
{
int elements = 0;
int lastIndex=0;
int *arrayList= new int [elements];
}
void ArrayList :: add(int n, )
{
arrayList&[lastIndex]=n;
}
ArrayList* doubleSize(int [] arr&)
{
int [] arr2;= new ArrayList[arr->length*2];
for(int i=0; i<arr.length; i++)
arr2[i]=arr[i];
return arr2;
}
int ArrayList :: deleteLast()
{
int numDeleted=0;
if(arrayList!=0)
{
numDeleted=arrayList[size];
arrayList[size]=NULL;
if(size<
}
else
{
cout << "Array is empty";
}
return numDeleted;
}
int size()
{
int numElems=0;
for(int i=0;i<arr.length;i++)
{
if(arr[i]!=NULL)
numElems++;
}
return numElems;
}
int main()
{
cout << "Test" << endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.