61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
|
#ifndef TREES_HPP
|
||
|
#define TREES_HPP
|
||
|
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
|
||
|
// Namespace for different implementations of trees
|
||
|
namespace tree_implementation
|
||
|
{
|
||
|
// Base Tree class
|
||
|
class Tree
|
||
|
{
|
||
|
public:
|
||
|
Tree(void);
|
||
|
void Insert(void);
|
||
|
void Search(void);
|
||
|
void InOrderTreeTraversal(void);
|
||
|
protected:
|
||
|
virtual void PrintParentKey(std::string key) = 0;
|
||
|
virtual void PrintLeftChild(std::string key) = 0;
|
||
|
virtual void PrintRightChild(std::string key) = 0;
|
||
|
virtual void PrintPathToRoot(std::string key) = 0;
|
||
|
private:
|
||
|
;
|
||
|
};
|
||
|
|
||
|
// Binary Search Tree operations
|
||
|
// TODO: Implement BST
|
||
|
class BinarySearchTree : public Tree
|
||
|
{
|
||
|
public:
|
||
|
void PrintParentKey(std::string key);
|
||
|
void PrintLeftChild(std::string key);
|
||
|
void PrintRightChild(std::string key);
|
||
|
void PrintPathToRoot(std::string key);
|
||
|
protected:
|
||
|
;
|
||
|
private:
|
||
|
;
|
||
|
};
|
||
|
|
||
|
// Red-Black Tree operations
|
||
|
// TODO: Implement Red-black tree
|
||
|
class RedBlackTree : public Tree
|
||
|
{
|
||
|
public:
|
||
|
void PrintParentKey(std::string key);
|
||
|
void PrintLeftChild(std::string key);
|
||
|
void PrintRightChild(std::string key);
|
||
|
void PrintPathToRoot(std::string key);
|
||
|
void PrintColor(std::string key);
|
||
|
void PrintParentColor(std::string key);
|
||
|
void PrintUncleColor(std::string key);
|
||
|
protected:
|
||
|
;
|
||
|
private:
|
||
|
;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif
|