CST - #ifndef _CST_h #define _CST_h #include...

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

View Full Document Right Arrow Icon
#ifndef _CST_h #define _CST_h #include "DataType.h" template <typename dataType> struct treeNodeType { dataType fData; treeNodeType* fLeftChild; treeNodeType* fRightChild; }; //typedef struct treeNodeType* treeNodePtrType; template <typename dataType> class CST { public: CST() : fRoot(NULL), fNumItems(0) {} // Default constructor virtual ~CST() {} // Virtual destructor CST& operator=(const CST cst) { if (this != &cst) {} return *this;} // Overloaded assignment operator inline short GetNumItems () {return fNumItems;} inline bool IsEmpty () { if (fRoot == NULL) return true; else return false; } { static bool firstTime = true; if (firstTime) { fRoot = RecursiveCreateNextAvailable (fRoot, data); firstTime = false; } else RecursiveCreateNextAvailable (fRoot, data); ++fNumItems; } { short count = 0; treeNodeType<dataType>* nodePtr; nodePtr = RecursiveBinaryTreeSearch(fRoot, index, count); return nodePtr->fData; } { treeNodeType<dataType>* nodePtr; nodePtr = RecursiveBinaryTreeSearchByKey(fRoot, data); return nodePtr->fData;
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 01/17/2012 for the course CSC 1254 taught by Professor Blanks,l during the Fall '08 term at LSU.

Page1 / 4

CST - #ifndef _CST_h #define _CST_h #include...

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