// File: btnode.cpp // Original Author: David Metcalf // Last Modified: Spring 2000 // Topic: Binary Tree // ----------------------------------------------------- // // OVERVIEW: // Implementation of tree node methods. #include #include "btnode.h" //------------------------------------------------------------ // BTNode::BTNode constructors // // Creates BTNode and (optionally) initializes it to contain "item". // There are 2 constructors: one can be invoked without an argument // and one takes a single argument. // // Note: Defining a class method with two different parameter lists is // called "function overloading". The method actually invoked is the one // whose parameters match. BTNode::BTNode() { lChild = NULL; rChild = NULL; } BTNode::BTNode(ItemType item) { lChild = NULL; rChild = NULL; data = item; } //------------------------------------------------------------ // BTNode::getData // Usage: item = node.getData(); // // Returns data stored in node. ItemType BTNode::getData() const { } //------------------------------------------------------------ // BTNode::getLeftChild // Usage: nptr = node.getLeftChild(); // // Returns pointer to left child. BTNode *BTNode::getLeftChild() const { } //------------------------------------------------------------ // BTNode::getRightChild // Usage: nptr = node.getRightChild(); // // Returns pointer to right child. BTNode *BTNode::getRightChild() const { } //------------------------------------------------------------ // BTNode:setData // Usage: node.setData(item); // // Sets/changes data stored in node. void BTNode::setData(ItemType item) { } //------------------------------------------------------------ // BTNode::setLeftChild: // Usage: node.setLeftChild(nptr); // sets/changes left child of node void BTNode::setLeftChild(BTNode *nptr) { } //------------------------------------------------------------ // BTNode::setRightChild // Usage: node.setRightChild(nptr); // // Sets/changes right child of node. void BTNode::setRightChild(BTNode *nptr) { }