blob: 2e3693c9b442ce1df23d0e656c5813587b0fe6bf (
plain) (
blame)
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
|
#ifndef MAPPER_H
#define MAPPER_H
#include "utils.h"
// ###### DO NOT REMOVE ######
#define MAXKEYSZ 100
#define MAXVALUESZ 100
// ###### DO NOT REMOVE ######
char *mapOutDir;
int mapperID;
// You are free to change the intermediate data structure as it suits you
// If you do so, ensure the provided utility functions are also changed
// 1 1 1...
typedef struct valueList {
// MAXVALUESZ can be reduced to a small value as you are only storing "1"
char value[MAXVALUESZ];
struct valueList *next;
}valueList;
// word 1 1 1...
typedef struct intermediateDS{
char key[MAXKEYSZ];
valueList *value;
struct intermediateDS *next;
}intermediateDS;
// ###### DO NOT REMOVE ######
valueList *createNewValueListNode(char *value);
valueList *insertNewValueToList(valueList *root, char *count);
void freeValueList(valueList *root);
// ###### DO NOT REMOVE ######
intermediateDS *createNewInterDSNode(char *word, char *count);
intermediateDS *insertPairToInterDS(intermediateDS *root, char *word, char *count);
void freeInterDS(intermediateDS *root);
// ###### DO NOT REMOVE ######
void emit(char *key, char *value);
void map(char *chunkData);
void writeIntermediateDS();
#endif
|