C++ pointers

Pages: 12
Can I perform operations such as intersection and union on these? But yes, I do want an efficient set. I just need to get my head around how to implement them into a class...perhaps if could provide an example?

Cheers
The theory of these BST is understandable but how would I use them to create a SET?... I am well and truly in at the deep end.
Right I understand the concept of BST and I got my hands some code to practice with. One question, can these BST's utilize templates to make the program as flexible as possible. For example not just int but other types like string and user defined types.

Thanks
Of course.
Can you show me how to code a template on a BST. Heres my BST code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class StudentRegister
{
	private:
        struct Node
        {
           Node* left;
           Node* right;
           int data;
        };
        Node * root;
    
    public:
        StudentRegister()
        {
           root = NULL;
        }
       
        bool isEmpty() const { return root==NULL; }
        void print_inorder();
        void inorder(Node *);
        void print_preorder();
        void preorder(Node *);
        void print_postorder();
        void postorder(Node *);
        void insert(int);
        void remove(int);
};
Helios:

Hint:
use a supporting data structure with a link list. that's all i can tell because there is no standard method for that which you can find in a book. If not then implement whatever you want red tree, blue tree or even a combination of both.
Last edited on
Topic archived. No new replies allowed.
Pages: 12