-
Notifications
You must be signed in to change notification settings - Fork 0
/
postingList.h
48 lines (36 loc) · 1.36 KB
/
postingList.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
#ifndef POSTING_LIST_H
#define POSTING_LIST_H
typedef struct postingList postingList;
postingList *createPL(int textIndex, int count);
/* Creates new posting list with one node containing textIndex and count
* and returns a pointer to it. If memory allocation fails NULL is returned
*/
int addAppearancePL(postingList *pl, int textIndex);
/* Adds one apperance to the index given in an already existing posting list
* if the posting list doesn't contain the index then a new node is created
* if memory allocation fails for the new node 0 is returned otherwise 1
*/
void deletePL(postingList *pl);
/* Given the first node of the posting list, it deletes all the list's nodes
* freeing all memory allocated for the list
*/
postingList *getNextPL(postingList *pl);
/* Given a node of the posting list, it returns the next node in the list
*/
int getIndexPL(postingList *pl);
/* Returns the textIndex of the given node
*/
int getCountPL(postingList *pl);
/* Returns the appearance count of the given node
*/
int getSizePL(postingList *pl);
/* Given the staring node of the list, returns the number of nodes in the list
*/
int getTotalAppearancesPL(postingList *pl);
/* Given the starting node of the list, return the sum of appearance count
* int all the list's nodes
*/
void printPL(postingList *pl);
/* Prints all the indices and appearance counts in the list
*/
#endif