trie_tree.cpp File Reference

Implementation of Trie data structure for English alphabets in small characters. More...

`#include <array>`
`#include <cassert>`
`#include <iostream>`
`#include <memory>`
`#include <string>`
`#include <vector>`
Include dependency graph for trie_tree.cpp:

## Classes

class | data_structures::trie
| Trie implementation for small-case English alphabets `a-z` More...

## Namespaces

| data_structures
| Data Structures algorithms.

## Functions

static void | test ()
| Testing function. More...
int | main ()
| Main function. More...

## Detailed Description

Implementation of Trie data structure for English alphabets in small characters.

Author
  @Arctic2333
  Krishna Vedala

Note
  the function ::data_structure::trie::deleteString might be erroneous

See also
  trie_modern.cpp

## Function Documentation

## main()

int main | ( | void |  | ) |

Main function.

Returns
  0 on exit

{
test();
return 0;
}
test
static void test()
Testing function.
Definition: trie_tree.cpp:178
Here is the call graph for this function:

## test()

static void test | ( |  | ) |

static

Testing function.

Returns
  void

{
data_structures::trie root;
root.insert("Hello");
root.insert("World");
assert(!root.search("hello", 0));
std::cout << "hello - " << root.search("hello", 0) << "\n";
assert(root.search("Hello", 0));
std::cout << "Hello - " << root.search("Hello", 0) << "\n";
assert(!root.search("Word", 0));
std::cout << "Word - " << root.search("Word", 0) << "\n";
assert(root.search("World", 0));
std::cout << "World - " << root.search("World", 0) << "\n";
// Following lines of code give erroneous output
// root.deleteString("hello", 0);
// assert(!root.search("hello", 0));
// std::cout << "hello - " << root.search("world", 0) << "\n";
}
std::cout
data_structures::trie
Trie implementation for small-case English alphabets a-z
Definition: trie_tree.cpp:25
std::vector::insert
T insert(T... args)