Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
assignment210ct/binTree.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (31 sloc)
791 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _BINTREE_H | |
#define _BINTREE_H | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <vector> | |
#include "helper.h" | |
class BinTree { | |
struct binTreeNode { | |
std::string text; | |
int count; | |
binTreeNode *left; | |
binTreeNode *right; | |
}; | |
binTreeNode *root; | |
BinTree::binTreeNode *insert(binTreeNode *tree, const std::string &text); | |
bool contains(binTreeNode *tree, const std::string &text); | |
int getCount(binTreeNode *tree, const std::string &text); | |
void inOrder(binTreeNode *tree); | |
void preOrder(binTreeNode *tree); | |
void postOrder(binTreeNode *tree); | |
public: | |
BinTree(); | |
void insert(const std::string &text); | |
bool contains(const std::string &text); | |
int getCount(const std::string &text); | |
void inOrder(); | |
void preOrder(); | |
void postOrder(); | |
}; | |
#endif //_BINTREE_H |