// Chap 3, pp 131 - 133
// Change the name of this file to ListA.h

// *********************************************************
// Header file ListA.h for the ADT list.
// Array-based implementation.
// *********************************************************
const int MAX_LIST = 20;   // maximum-size-of-list;
typedef int listItemType;  // desired-type-of-list-item
#include "boolean.h"  // See Appendix A

class listClass
{
public:
// constructors and destructor:
   listClass();                    // constructor
   listClass(const listClass& L);  // copy constructor
   ~listClass();                   // destructor

// list operations:
   boolean ListIsEmpty();
   // Determines whether a list is empty.
   // Precondition: The constructor has been called.
   // Postcondition: Returns TRUE if the list is empty,
   // otherwise returns FALSE.

   int ListLength();
   // Determines the length of a list.
   // Precondition: The constructor has been called.
   // Postcondition: Returns the number of items
   // that are currently on the list.

   void ListInsert(int NewPosition, listItemType NewItem,
                   boolean& Success);
   // Inserts an item into a list.
   // Precondition: The constructor has been called. 
   // NewPosition indicates where the insertion should 
   // occur, NewItem is the item to be inserted.
   // Postcondition: If insertion is successful,
   // NewItem is at position NewPosition in the list,
   // other items are renumbered accordingly, and
   // Success is TRUE; otherwise Success is FALSE.
   // Note: Insertion will not be successful if
   // NewPosition < 1 or > ListLength()+1.

   void ListDelete(int Position, boolean& Success);
   // Deletes an item from a list.
   // Precondition: The constructor has been called. 
   // Position indicates where the deletion should occur.
   // Postcondition: If 1 <= Position <= ListLength(),
   // the item at position Position in the list is
   // deleted, other items are renumbered accordingly,
   // and Success is TRUE; otherwise Success is FALSE.

   void ListRetrieve(int Position, listItemType& DataItem, 
                     boolean& Success);
   // Retrieves a list item by position number.
   // Precondition: The constructor has been called. 
   // Position is the number of the item to be retrieved.
   // Postcondition: If 1 <= Position <= ListLength(),
   // DataItem is the value of the desired item and
   // Success is TRUE; otherwise Success is FALSE.

private:
   listItemType Items[MAX_LIST];  // array of list items
   int          Size;             // number of items on list

   int Index(int Position);
   // Converts the position of an item in a list to the 
   // correct index within its array representation.
};  // end class
// End of header file.

    Source: geocities.com/siliconvalley/program/2864/ds/CHAP3

               ( geocities.com/siliconvalley/program/2864/ds)                   ( geocities.com/siliconvalley/program/2864)                   ( geocities.com/siliconvalley/program)                   ( geocities.com/siliconvalley)