-
Notifications
You must be signed in to change notification settings - Fork 0
/
posting_list.h
48 lines (35 loc) · 927 Bytes
/
posting_list.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
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <sys/ioctl.h>
#include <unistd.h>
using namespace std;
class posting_list
{
public:
posting_list();
~posting_list();
void update(char * word, unsigned int doc_id);
void print(bool full_print);
unsigned int get_size();
unsigned int get_term_freq(unsigned int doc_id);
unsigned int * add_doc_id_to_array(unsigned int * unq_doc_ids, unsigned int & unq_doc_ids_size);
private:
struct node
{
unsigned int doc_id;
unsigned int freq;
node * next;
};
unsigned int pl_size; //df
node * first;
void destroy();
char * word;
node * create_node(unsigned int doc);
};
#endif // POSTING_LIST_H