/* Ex7: UNIT TEST of Btree fucntion PushIn */ #include #include #define MAX 4 typedef char Key_type; typedef struct node_tag { int count; Key_type key[MAX+1]; struct node_tag *branch[MAX+1]; } Node_type; /* PushIn: inserts key x and pointer xr into node p at position k+1; requires that the node was not previously full. */ void PushIn(Key_type x,Node_type *xr,Node_type *p, int k) { int i; /* index to move keys to make room for x */ for (i = p->count; i > k+1; i--) { /* Shift all the keys and branches to the right. */ p->key[i+1] = p->key[i]; p->branch[i+1] = p->branch[i]; } p->key[k+1] = x; p->branch[k+1] = xr; p->count++; } void PrintPage(Node_type *p) { int i; for (i=1; i <= p->count; i++) printf("%c ",p->key[i]); printf("\n"); } int main() { Node_type *p; p = (Node_type *)malloc(sizeof(Node_type)); }