I have class arraylist with all basic procedures (checkIndex, get, insert, erase nad output).
In private or protected part i have:
I have to add two methods in class:Code:T* element //1D field that contains elements of list int arrayLength //size of field int listSize //number of elements in list
- arrayList<T>::removeRange ( remove elements on given interval. Interval has to be passed with inital and final index)
Example: x=[1,2,3,4,5] //list
x.removeRange(1,3) //call method
x=[1,5] //result- arrayList<T>::swap(i,j)
(replace elements on indexes i and j)
Example: x=[1,2,3,4,5] //list
x.swap(1,3) //call method
x=[1,4,3,2,5] //result
I try to add those two methods but without success
I don't know what to write in parenthesises beside method, which two variables should I use? Can I just come up with new two of them or have I use already existent?
I also attached how i try to write one method. I don't know if this is right type of thinking or should i think in different way.
Every opinion and help is more than wellcome