Question: With the following declaration, do problem 1&2: const int MAX=10; class AList{ public : AList(); void Retrieve(int k, &x, int bool &success); etrieve the
With the following declaration, do problem 1&2:
const int MAX=10;
class AList{
public :
AList();
void Retrieve(int k, &x, int bool &success);
\ etrieve the kth element and save it in x
void Delete(int k, int &x, bool &success);
\\ delete element at the position with index k and save it in x
void Insert(int k, int x, bool &success);
\\ insert element x at the position with index k
private :
int list[MAX];
int size;
};
AList aList;
1.With only the above methods, how do you implement the function swap (swap (aList, i, j) ) that interchanges the items currently in positions i and j of a list.
2.Add a method swap (that interchanges the items currently in positions i and j) to the above class and implement it.
3.Revise the specifications of the above list to make insertion, deletion, retrieval operations are at the end of the list; and implement these new methods.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
