Search code examples
stringdata-structurestreetrie

What kind of tree is this that has letters as nodes?


I just started learning C++ and I need to create a tree of lists (Image link below) for a project but I'm not sure if it is a custom tree or a preexisting tree.

A bit on the tree; big blue blocks represent lists, smaller blocks inside represent nodes.

I am not looking for code or anything, just an explanation of the tree or links to where I could find information on it.

Image Here


Solution

  • The data structure in the image is Trie data structure.

    Trie is an efficient information retrieval data structure. Using trie, search complexities can be brought to optimal limit (key length). - (Source : GeeksForGeeks)

    Trie shown in the image is made for the following strings -
    Act, Actual, Actually, And, Book, Boss, Bore, Board and Boat.

    Some useful links to know more -