Strie is a tree data structure that stores a set of words in a very space efficient way. The following is an example of basic structures of a Strie and Strie nodes. see image.
To provide this unique capability of storing character strings, Stries need to follow some rules. Each node of a Strie, except the root node, contains a character and can have up to 26 children. Root node (and all other nodes) store(s) links to other nodes, one for each possible character in the English alphabet. Following is a sample Strie that has 4 words (bar, barn, bat, cat) stored in it. see image.
If you look carefully at the above Stries, you would notice some interesting properties that may help you in implementing this project! For example, since there are 26 possible slots for the children of a node and since the alphabet is in order, you will always find a particular character at a particular index! Also, words with common prefix share a common branch! Note that words sharing common prefixes may affect the implementation of some operations. For example, if you remove the word "bat", your Strie would look like the following picture. see image.
The character 't' does not exist in the Strie anymore under ba but it does still exist under ca for cat. In contrast, if you remove the word "bar", your Strie would look like following picture. Notice that the character r still exists in Strie, but it no longer marks the end of a word. see image.
You can use the Strie for many different purposes. For example, you can store words, look up a word, search for words having common prefix, search for similar words for a given query, and many more. To implement such a Strie, you need to complete all required classes, and possibly some (or all) optional classes depending on which functionality you want your Strie to provide.
An overview of the requirements are listed below, please see the grading rubric for more details.
This project will be built using a number of classes representing the component pieces of the project. Here we provide a description of these classes. Template files are provided for each class in the project folder and these contain further comments and additional details.
Completed Class
Required Classes
The StrieNode Class (see StrieNode.java) This class represents a single Strie node. It provides some methods required to manipulate a node. Check the included template file for all required methods and their corresponding big-O requirements.
The Strie Class (see Strie.java) This class implements the Strie data structure. It must use StrieNode objects for storing a node. It supports some basic Strie operations such as inserting a word, removing a word, searching for a word, and more.
Required methods:
Choose your own adventure methods: