1. Engineering
  2. Computer Science
  3. 44 using the list adt of figure 41 p98 of...

Question: 44 using the list adt of figure 41 p98 of...

Question details

4.4 Using the list ADT of Figure 4.1 (P98 of our textbook), write a function to interchange the current element and the one following it.template <typename E> class List private // List ADT void operator= (const List&) {} List (const List&)) // Protect assignment // Protect copy constructor public List) th virtual List O I/ Base destructor /I Default constructor // Clear contents from the list, to make it empty virtual void clear0 / Insert an element at the current location // item: The element to be inserted virtual void insert (const E& item) 0; // Append an element at the end of the list // item: The element to be appended virtual void append(const E& item) 0; // Remove and return the current element. // Return: the element that was removed virtual E remove() O; // Set the current position to the start of the list virtual void moveToStart() = 0; // Set the current position to the end of the list virtual void moveToEnd() 0; // Move the current position one step left. No change // if already at beginning virtual void prev() 0; // Move the current position one step right. No change // if already at end virtual void next() 0; // Return: The number of elements in the list. virtual int length) const0 // Return: The position of the current element. virtual int currPos const0; // Set current position // pos: The position to make current virtual void moveToPos (int pos) 0; // Return: The current element virtual const E& getValue() const = 0; Figure 4.1 The ADT for a list

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution