o Do: LinkedList.h: add a new Node* called tailPtr which points to the last item in the list   @file ListInterface.h */ #ifndef _LIST_INTERFACE #define _LIST_INTERFACE template class ListInterface { public:    /** Sees whether this list is empty.     @return True if the list is empty; otherwise returns false. */    virtual bool isEmpty() const = 0;        /** Gets the current number of entries in this list.     @return The integer number of entries currently in the list. */    virtual int getLength() const = 0;        /** Inserts an entry into this list at a given position.     @pre  None.     @post  If 1 <= position <= getLength() + 1 and the insertion is        successful, newEntry is at the given position in the list,        other entries are renumbered accordingly, and the returned        value is true.     @param newPosition  The list position at which to insert newEntry.     @param newEntry  The entry to insert into the list.     @return  True if insertion is successful, or false if not. */    virtual bool insert(int newPosition, const ItemType& newEntry) = 0;        /** Removes the entry at a given position from this list.     @pre  None.     @post  If 1 <= position <= getLength() and the removal is successful,        the entry at the given position in the list is removed, other        items are renumbered accordingly, and the returned value is true.     @param position  The list position of the entry to remove.     @return  True if removal is successful, or false if not. */    virtual bool remove(int position) = 0;        /** Removes all entries from this list.     @post  List contains no entries and the count of items is 0. */    virtual void clear() = 0;        /** Gets the entry at the given position in this list.     @pre  1 <= position <= getLength().     @post  The desired entry has been returned.     @param position  The list position of the desired entry.     @return  The entry at the given position. */    virtual ItemType getEntry(int position) const = 0;        /** Replaces the entry at the given position in this list.     @pre  1 <= position <= getLength().     @post  The entry at the given position is newEntry.     @param position  The list position of the entry to replace.     @param newEntry  The replacement entry. */    virtual void setEntry(int position, const ItemType& newEntry) = 0; }; // end ListInterface #endif

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

To Do:

LinkedList.h: add a new Node* called tailPtr which points to the last item in the list

 

@file ListInterface.h */

#ifndef _LIST_INTERFACE
#define _LIST_INTERFACE

template<class ItemType>
class ListInterface
{
public:
   /** Sees whether this list is empty.
    @return True if the list is empty; otherwise returns false. */
   virtual bool isEmpty() const = 0;
   
   /** Gets the current number of entries in this list.
    @return The integer number of entries currently in the list. */
   virtual int getLength() const = 0;
   
   /** Inserts an entry into this list at a given position.
    @pre  None.
    @post  If 1 <= position <= getLength() + 1 and the insertion is
       successful, newEntry is at the given position in the list,
       other entries are renumbered accordingly, and the returned
       value is true.
    @param newPosition  The list position at which to insert newEntry.
    @param newEntry  The entry to insert into the list.
    @return  True if insertion is successful, or false if not. */
   virtual bool insert(int newPosition, const ItemType& newEntry) = 0;
   
   /** Removes the entry at a given position from this list.
    @pre  None.
    @post  If 1 <= position <= getLength() and the removal is successful,
       the entry at the given position in the list is removed, other
       items are renumbered accordingly, and the returned value is true.
    @param position  The list position of the entry to remove.
    @return  True if removal is successful, or false if not. */
   virtual bool remove(int position) = 0;
   
   /** Removes all entries from this list.
    @post  List contains no entries and the count of items is 0. */
   virtual void clear() = 0;
   
   /** Gets the entry at the given position in this list.
    @pre  1 <= position <= getLength().
    @post  The desired entry has been returned.
    @param position  The list position of the desired entry.
    @return  The entry at the given position. */
   virtual ItemType getEntry(int position) const = 0;
   
   /** Replaces the entry at the given position in this list.
    @pre  1 <= position <= getLength().
    @post  The entry at the given position is newEntry.
    @param position  The list position of the entry to replace.
    @param newEntry  The replacement entry. */
   virtual void setEntry(int position, const ItemType& newEntry) = 0;
}; // end ListInterface
#endif

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY