-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ2_r_2018201103.cpp
More file actions
41 lines (33 loc) · 794 Bytes
/
Copy pathQ2_r_2018201103.cpp
File metadata and controls
41 lines (33 loc) · 794 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
32
33
34
35
36
37
38
39
40
41
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAXKEYS 2
#define MINKEYS MAXKEYS/2
/*
btree node
node_count maintains the number of elements present in node
key array contains elements in node
pointer contains child pointers
pointer[0] is left pointer of key[1]
pointer[1] is right pointer of key[1] and left pointer of key[2] and so on...
*/
struct btNode {
ll key[MAXKEYS + 1];
ll node_count;
struct btNode *pointer[MAXKEYS + 1];
};
struct btNode* root;
void insert(ll key, struct btNode* node){
if(node==NULL){
node->key=key;
node->pointer[0]=NULL;
}
}
int main(){
ios_base::sync_with_stdio(false);
ll key;
cout<<"enter key"<<endl;
cin>>key;
insert(key,root);
return 0;
}