LinkedList - / * / Implementation file ListP.cpp for the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// ********************************************************* // Implementation file ListP.cpp for the ADT list. // Pointer-based implementation. // ********************************************************* #include "LinkedList.h" // header file #include <cstddef> // for NULL ListReferenceBased::ListReferenceBased() : numItems(0), head(NULL) {} // end default constructor ListReferenceBased::~ListReferenceBased() { removeAll(); } // end destructor bool ListReferenceBased::isEmpty() const { return numItems == 0; } // end isEmpty int ListReferenceBased::size() const { return numItems; } // end size ListReferenceBased::Node *ListReferenceBased::find(int index) const // -------------------------------------------------- // Locates a specified node in a linked list. // Precondition: index is the number of the // desired node. // Postcondition: Returns a pointer to the desired // node. // -------------------------------------------------- { // count from the beginning of the list Node *curr = head;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/26/2010 for the course CMPT 225 taught by Professor Annelavergne during the Spring '07 term at Simon Fraser.

Page1 / 2

LinkedList - / * / Implementation file ListP.cpp for the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online