#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🌲 FREE · STEP BY STEP

Trie Visualizer: See How Prefix Trees Work

Type words to build a trie, then run search, prefix search, insert or delete and replay each step on the tree.

  • 🔤 Insert and delete
  • 🔍 Prefix search
  • 📊 Nodes and words

How to use the Trie Visualizer

  1. 1. Add wordsType words separated by commas and press Build trie. Only letters a–z are used.
  2. 2. Choose an operationSearch for a word, list words with a prefix, insert or delete.
  3. 3. ReplayStep through the path character by character; matching nodes are highlighted.

Worked example

The sample words cat, car, cart, care, dog, do and dot make a trie of 11 nodes including the root: c-a branches to r and t, r continues to t and e, and d-o branches to g and t. A prefix search for "ca" follows c then a and lists 4 words: car, care, cart, cat. Searching for "ca" as a whole word says it's only a prefix, because the a node isn't marked as the end of a word. Searching "do" finds it, because "do" was inserted and its o node is marked.

Why tries are fast

Every operation walks one node per character, so it costs O(L) for a word of length L, whether the trie holds 10 words or 10 million. Shared prefixes share nodes, which saves space when words overlap a lot. That makes tries the standard structure for autocomplete, spell checkers and word games, and for interview problems like Implement Trie and Word Search II.

Deleting correctly

Deleting a word unmarks its last node, then removes nodes from the bottom up only if no other word needs them. Delete "cart" from the sample and only its t node goes; "car" and "care" stay. Delete "do" and no nodes are removed, because "dog" and "dot" still pass through them.

Frequently asked questions

Can I use capital letters or numbers?

Words are converted to lower case and anything other than a–z is removed.

Is there a limit?

No hard limit, but around 30 words keeps the drawing readable.

What does the ● mean?

That node is the end of a stored word.

Is the trie visualizer free?

Yes. Everything in the trie visualizer works without signing up. The first time you ask for a result, we ask once for your name and WhatsApp number; after that the trie visualizer and every other Uncodemy tool open straight away.

More free tools

See all free tools