A performance comparison tool for autocomplete functionality using two different data structures: Trie (Prefix Tree) and Ternary Search Tree (TST).
This project implements and benchmarks two popular data structures for autocomplete systems:
- Trie (Prefix Tree): A tree-like data structure where each node represents a character, optimized for fast prefix lookups
- TST (Ternary Search Tree): A space-efficient alternative that combines properties of binary search trees and tries
The program loads a dictionary of words, builds both data structures, and allows you to interactively query them while measuring their performance characteristics including:
- Build time (milliseconds)
- Memory usage (megabytes)
- Query time (microseconds)
We opted in using Clion due to running into some linking issues with VScode
- Open CLion and select
File → Open - Navigate to and select the
The-Compilers-Auto-Completefolder - CLion will automatically detect the CMakeLists.txt and configure the project
- Click the green play button or press
Shift+F10to build and run
You may either use our list of words found in include/words.txt or you may create your own by:
- Create a
datafolder in the project root if it doesn't exist - Add a
words.txtfile containing one word per line - Example
words.txt:
apple
application
apply
banana
band
- Run the program
- Wait for both data structures to build (timing will be displayed)
- Enter a prefix when prompted (e.g., "app" to find "apple", "application", etc.)
- View the top 10 suggestions from both Trie and TST
- Compare the query times (displayed in microseconds)
- Type
exitto quit