const int MAX = 10;
class AList {
public:
AList();
void Retrieve(int k, int &x, bool &success); // retrieve 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(aList, i, j) that interchanges the items currently in positions i and j of a list?
2. Revise the specifications of the above list to make insertion, deletion, and retrieval operations at the end of the list; and implement these new methods.