Initial commit

This commit is contained in:
jslightham
2023-05-21 23:28:11 -04:00
commit 0360e7dfcc
31 changed files with 2068 additions and 0 deletions

33
P3/Trie.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef TRIE_H
#define TRIE_H
#include <iostream>
#include <vector>
class Trie
{
public:
Trie();
~Trie();
bool Insert(std::string s);
bool Remove(std::string s);
void DepthFirstSearch(std::vector<std::string> *out, std::string s);
bool IsEmpty();
void Clear();
int Size();
int CountSuffixes(std::string s);
bool SpellCheck(std::vector<std::string> *out, std::string check, std::string s);
private:
const int MAX_SLOTS = 26;
const int ASCII_FACTOR = 65;
const int ASCII_UPPER = 90;
int count;
bool isEnd;
Trie **children;
bool PerformInsert(std::string s);
bool PerformRemove(std::string s);
int PerformCountSuffixes(std::string s);
};
#endif