Files
data-structures-and-algorithms/homework4/BiTree.h
T
2024-11-22 17:16:02 +08:00

25 lines
544 B
C++

#ifndef BITREE_H
#define BITREE_H
#include<sstream>
class BiTree
{
public:
int data;
BiTree* left;
BiTree* right;
static bool is_empty(BiTree* bt);
static bool is_leaf(BiTree* bt);
static int sum_leaf(BiTree* bt);
static BiTree* createNode(int data);
static void insertNode(BiTree*& bt, int value);
static BiTree* build_from_preorder_string(const std::string& preorder, size_t& index);
void inOrder(std::ostringstream& oss) const;
std::string toString();
void destory();
};
#endif //BITREE_H