-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubtreeStack.h
More file actions
41 lines (29 loc) · 848 Bytes
/
SubtreeStack.h
File metadata and controls
41 lines (29 loc) · 848 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
38
39
40
41
#ifndef SUBTREESTACK_H
#define SUBTREESTACK_H
#include "Node.h"
using namespace std;
// Stack to generate huffman tree from subtrees based on its post order traversal encryption
class SubtreeStack {
public:
// Node for stack containing subtrees
struct Subtree {
Node *data;
Subtree *next;
Subtree();
~Subtree();
};
Subtree *head;
SubtreeStack();
~SubtreeStack();
unsigned int getSize();
void push(Node *node);
/* Removes two of the first subtrees and combines them into larger subtree
then pushes larger subtree back into stack */
void pop();
// For testing purposes only
void print();
private:
unsigned int size;
void print(Subtree *startPoint);
};
#endif