Created
August 15, 2012 05:52
-
-
Save chancez/3356616 to your computer and use it in GitHub Desktop.
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
#include "Skill.h" | |
#include "SkillNode.h" | |
#include <stdlib.h> | |
SkillNode::SkillNode(): children(NULL) | |
{ | |
} | |
SkillNode::SkillNode(Skill& aSkill): skill(aSkill), children(NULL) | |
{ | |
this->children = new SkillNode[MAX_CHILDREN]; | |
} | |
void SkillNode::insert(SkillNode*& root, const Skill& aSkill) | |
{ | |
if(root) | |
{ | |
root = new SkillNode(aSkill); | |
// work around below.. | |
// root = new SkillNode(); | |
// root->skill = aSkill; | |
} | |
} |
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 SKILLNODE_H | |
#define SKILLNODE_H | |
#include "Skill.h" | |
class SkillNode | |
{ | |
public: | |
SkillNode(); | |
SkillNode(Skill& aSkill); | |
~SkillNode(); | |
void insert(SkillNode*& root, const Skill& aSkill); | |
bool contains(SkillNode& root, char ch) const; | |
void display(ostream& out, SkillNode * root, int level) const; | |
private: | |
Skill skill; | |
SkillNode *children; | |
const int MAX_CHILDREN = 3; | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment