-
Notifications
You must be signed in to change notification settings - Fork 0
/
books.h
50 lines (41 loc) · 1.51 KB
/
books.h
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
#ifndef BOOKS_H
#define BOOKS_H
#include "utility.h"
#include <stdlib.h>
#define NAME_SIZE 50
typedef struct book{
char name[NAME_SIZE];
char subject[NAME_SIZE];
char authors[NAME_SIZE];
int acc_no;
int year_pub;
int no_issued; //number of copies of books issued
int no_unissued; //number of copies of books available
}; // book element
typedef struct book_node{
struct book *keys; //array of keys
int t; //min degree
struct book_node **C; // array of child pointers
int n; // current no of keys
int leaf; // is key leaf(boolean value)
};
typedef struct book_tree{ // B-Tree
struct book_node *root; // ptr to root node
int t; // min degree
};
int book_cmp(struct book a, struct book b);
// book node functions
struct book_node* init_book_node(int, int); // Constructor
void insertNonFull_book(struct book_node *bookm , struct book k);
// A utility function to split the child y of this node. i is index of y in
// child array C[]. The Child y must be full when this function is called
void splitChild_book(struct book_node* bookm, int i, struct book_node *y);
// A function to traverse all nodes in a subtree rooted with this node
// void traverse(struct book_node* bookm);
// A function to search_book a key in the subtree rooted with this node.
// struct book_node *search_book(struct book_node *bookm, int k);
// book node functions end
// book tree functions
void init_book_tree(struct book_tree*, int);
void insert_book(struct book_tree*, struct book);
#endif