part 3 complete
This commit is contained in:
@@ -2,36 +2,26 @@
|
||||
#define IKT203_COURSE_ASSIGNMENTS_TBST_H
|
||||
#include "TEmployee.h"
|
||||
|
||||
|
||||
struct Node {
|
||||
struct BSTNode {
|
||||
int key;
|
||||
TEmployee* data;
|
||||
Node* left;
|
||||
Node* right;
|
||||
BSTNode* left;
|
||||
BSTNode* right;
|
||||
};
|
||||
|
||||
|
||||
class TBST {
|
||||
private:
|
||||
Node* root;
|
||||
BSTNode* root;
|
||||
|
||||
static Node* insert(Node* node, int key, TEmployee* data);
|
||||
|
||||
static Node* search(Node* node, int key);
|
||||
|
||||
static Node* remove(Node* node, int key);
|
||||
|
||||
static void inorder(const Node* node);
|
||||
|
||||
static void preorder(const Node* node);
|
||||
|
||||
static void postorder(const Node* node);
|
||||
|
||||
static void levelorder(const Node* node);
|
||||
|
||||
static void destroy(Node* node);
|
||||
|
||||
static Node* findMin(Node* node);
|
||||
static BSTNode* insert(BSTNode* node, int key, TEmployee* data);
|
||||
static BSTNode* search(BSTNode* node, int key);
|
||||
static BSTNode* remove(BSTNode* node, int key);
|
||||
static void inorder(const BSTNode* node);
|
||||
static void preorder(const BSTNode* node);
|
||||
static void postorder(const BSTNode* node);
|
||||
static void levelorder(const BSTNode* node);
|
||||
static void destroy(BSTNode* node);
|
||||
static BSTNode* findMin(BSTNode* node);
|
||||
|
||||
public:
|
||||
TBST() = default;
|
||||
@@ -40,13 +30,9 @@ class TBST {
|
||||
void Insert(int key, TEmployee* data);
|
||||
[[nodiscard]] TEmployee* Search(int key) const;
|
||||
void Delete(int key);
|
||||
|
||||
void Inorder() const;
|
||||
void Preorder() const;
|
||||
void Postorder() const;
|
||||
|
||||
void LevelOrder() const;
|
||||
};
|
||||
|
||||
|
||||
#endif //IKT203_COURSE_ASSIGNMENTS_TBST_H
|
||||
Reference in New Issue
Block a user