본문 바로가기

Programming/DS SorceCode

BinaryTree_Dictionary.h :사전 클래스를 위한 이진 트리 클래스

#pragma once

#ifndef ___BinaryTree_Dictionary

#define ___BinaryTree_Dictionary

#include "BinaryNode_Dictionary.h"

//BinaryTree_Dictionary.h :사전 클래스를 위한 이진 트리 클래스

class BinaryTree {

protected:

BinaryNode* root;

public:

BinaryTree() : root(NULL) { }

bool isEmpty() { return root = NULL; }

void inorder(BinaryNode* node) {

if (node != NULL) {

if (node->getLeft() != NULL) inorder(node->getLeft());

node->display();

if (node->getRight() != NULL) inorder(node->getRight());

}

}

};

#endif // !___BinaryTree_Dictionary