#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define MAX 3 // Order of the B-tree #define MIN 2 // Minimum keys in a node typedef struct BTreeNode { int keys[MAX + 1]; // Array to store keys struct BTreeNode* children[MAX + 1]; // Array of child pointers int n; // Current number of keys bool leaf; // Is true if the node is a leaf } BTreeNode; BTreeNode* createNode(bool leaf) { BTreeNode* newNode = (BTreeNode*)malloc(sizeof(BTreeNode)); newNode->leaf = leaf; newNode->n = 0; // Initialize number of keys as 0 for (int i = 0; i <= MAX; i++) { newNode->children[i] = NULL; } return newNode; }