Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Tries

Rating
-
Sold
-
Pages
3
Uploaded on
31-05-2023
Written in
2022/2023

Its helpfyl for begineer who trying to study tries

Institution
Course

Content preview

The Trie Data Structure (Prefix Tree)

Tries: A Data Structure for Retrieving Strings of
Symbols
In this article, we will discuss Tries, a data structure used for retrieving
strings of symbols. We will cover what it is, how it works, and how to
build one. Tries are also known as prefix trees or digital trees. They
allow us to efficiently check whether or not a particular string is in our
set of strings. The source code is available through Patreon as usual.

Conceptual Overview of Tries
A Trie is a tree structure consisting of nodes that represent symbols in a
sequence. The node's children represent all of the symbols that could
come after that symbol. Tries are used to store sets of strings, and some
key operations, such as inserting new strings, deleting strings, and
searching to see if a string is in the set, are quite fast and scale well.

The main reason Tries are useful for storing sets of strings is that they
allow for efficient searching of strings in the set. For example, if we wan t
to search for the string "cat" in a Trie, we start at the root and move
down the tree until we find the nodes that represent the symbols "c",
"a", and "t". If we find a terminal node (marked as bold in our example),
then we know that "cat" is in our set of strings.

Another nice feature of Tries is that they are straightforward to print out
strings in sorted order using a simple depth-first search. This makes
Tries a solid data structure for people who want to store sets of sorted
searchable symbolic strings.

Building a Trie in C
Let's take a look at how to build a Trie in C. We will define a struct for
our Trie node and use an array of Trie node pointers to represent the
children of each node. The array acts like a lookup table, allowing us to
instantly know whether or not a particular letter is a child of a node.

Written for

Institution
Course

Document information

Uploaded on
May 31, 2023
Number of pages
3
Written in
2022/2023
Type
Class notes
Professor(s)
Aarthi
Contains
Tries

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
moureeswarans

Get to know the seller

Seller avatar
moureeswarans karpagam college of engineering
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions