-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB_node.h
More file actions
60 lines (48 loc) · 1.38 KB
/
B_node.h
File metadata and controls
60 lines (48 loc) · 1.38 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef B_NODE_H
#define B_NODE_H
#include <iostream>
#include "nodo.h"
using namespace std;
///AUTOR: MARIO GOMEZ PHAYNER
///IMPLEMENTACION DE EL NODO DEL ARBOL B CON EL USO DE TEMPLATES.
template <class Type, int order> class Btree;
template <class Type, int order> class B_node {
// data members:
friend class Btree< Type, order>;
private:
int count;
NodoFT* data[order-1];
B_node<Type, order> *childs[order];
// constructor:
public:
B_node();
B_node(NodoFT*);
bool NodeEmpty() const;
bool NodeFull() const;
void mostrarNodo();
// NodoFT *NodoFT;
};
template <class Type, int order> B_node< Type,order >::B_node(){
// NodoFT = NULL;
this->count = 0;
for(int i=0;i < order;i++)
this->childs[i] = NULL;
}
template <class Type, int order> B_node< Type,order >::B_node(NodoFT *k){
// NodoFT = k;
this->count = 0;
for(int i=0;i < order;i++)
this->childs[i] = NULL;
}
template< class Type, int order > bool B_node< Type,order>::NodeFull() const{
return (count== order-1);
}
template< class Type, int order > bool B_node< Type, order>::NodeEmpty() const {
return (count < (order-1)/2);
}
template< class Type, int order > void B_node< Type,order>::mostrarNodo() {
for(int i=0; i< this->count ;i++)
cout <<"\t"<< data[i]->index<<" - "<< data[i]->index_FT<<", ";
cout <<"\n";
}
#endif