-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContactTree.h
More file actions
31 lines (24 loc) · 772 Bytes
/
ContactTree.h
File metadata and controls
31 lines (24 loc) · 772 Bytes
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
28
29
30
31
#pragma once
#include <string>
#include<iostream>
using namespace std;
class ContactTree {
private:
//Defines the structure of the Binary Search tree,
//long long data type is used because int is not large enough to hold all phone numbers
struct ContactNode {
long long phoneNum;
string email;
ContactNode* left = NULL;
ContactNode* right = NULL;
};
ContactNode* root;
//private functions that handle insertion and displaying because a pointer perameter is needed to properly handle recursion
ContactNode* insertPrivate(ContactNode* rootptr, long long phone, string mail);
void displayPrivate(ContactNode* root);
public:
//Constructor
ContactTree();
void insert(long long phone, string mail);
void display();
};