Trie datastructure with search variants
More...
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstring>
#include <iostream>
#include <queue>
|
| static void | test () |
| | Function to test a simple search before and after deleting an entry. And to test out the multiple variants of search. More...
|
| |
| int | main (int argc, char const *argv[]) |
| | Main function. More...
|
| |
Trie datastructure with search variants
This provides multiple variants of search functions on a trie structure utilizing STL. The trie is valid for only English alphabets.
- Author
- Ghanashyam
◆ main()
| int main |
( |
int |
argc, |
|
|
char const * |
argv[] |
|
) |
| |
Main function.
- Parameters
-
| argc | commandline argument count (ignored) |
| argv | commandline array of arguments (ignored) |
- Returns
- 0 on exit
static void test()
Function to test a simple search before and after deleting an entry. And to test out the multiple var...
Definition: trie_multiple_search.cpp:422
◆ test()
Function to test a simple search before and after deleting an entry. And to test out the multiple variants of search.
425 "abcde",
"sss",
"ssss",
"ssst",
"sssu",
"sssv",
426 "sst",
"ssts",
"sstt",
"sstu",
"tutu",
"tutuv",
427 "tutuu",
"tutuvs",
"tutus",
"tvst",
"tvsu",
"vvvv"};
429 for (
auto &i : inputs) {
433 assert(root->SearchPresence(
"vvvv"));
436 root->Delete(
"vvvv");
438 assert(!root->SearchPresence(
"vvvv"));
442 root->SearchSuggestions(
"tutu");
445 root->SearchSuggestions(
"tutuv");
448 root->SearchSuggestions(
"tutuvs");
450 root->SearchFreqSuggestions(
453 root->SearchSuggestions(
Class defining the structure of trie node and containing the methods to perform operations on them.
Definition: trie_multiple_search.cpp:34