Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __INVERTEDINDEX_H__
- #define __INVERTEDINDEX_H__
- #define rest 5381
- typedef struct Array {
- int *v;
- int n, cap;
- } Array_t;
- typedef struct Entry {
- char *word;
- Array_t documents;
- } Entry_t;
- typedef struct Node {
- struct Node *next;
- Entry_t data;
- } Node_t, *ANode_t;
- typedef struct Map {
- Node_t **buckets;
- int size;
- } Map_t;
- unsigned long hash(unsigned char *str)
- {
- unsigned long hash = rest;
- int c;
- while((c = *str++)) {
- hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
- }
- return hash;
- }
- void put_doc(Map_t *map, char *key, int docID);
- Array_t get_docs(Map_t *map, char *key);
- Array_t intersection(const Array_t files1, const Array_t files2);
- Array_t reunion(const Array_t files1, const Array_t files2);
- void solve();
- #endif
Advertisement
Add Comment
Please, Sign In to add comment