-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEncoder.h
More file actions
37 lines (24 loc) · 897 Bytes
/
Copy pathEncoder.h
File metadata and controls
37 lines (24 loc) · 897 Bytes
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
#ifndef ENCODER_H
#define ENCODER_H
#include "TreeNode.h"
class Encoder {
public:
//public constructor passing array of letter frequencies.
Encoder(shared_ptr<vector<int> > vectorPtr);
//Encode std::string into a sequence of bytes.
shared_ptr<vector<char> > Encode(string);
//Decode an array of bytes into a std::string.
string Decode(shared_ptr<vector<char> >);
void makeTree();
void printCodes(shared_ptr<TreeNode> root, int arr[], int top);
char pack(vector<int> k);
private:
// Create a shared point of the queue
vector<TreeNode> treeVector;
TreeNode newTree;
// Create a copy of the vector
shared_ptr<vector<int> > frequency;
vector<pair<char, string> > v;
vector<char> letterVector = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
};
#endif // ENCODER.H