# Trie Data Structure β Video Tutorial

Hi codechef community,

I have made a video on Trie Data Structure on my Youtube Channel. If you are new to this data structure, I hope this video helps you out.

If you found the videos helpful please do leave a LIKE on it!

6 Likes

Watch your this tutorial yesterday ,really a great one.
Brother can you share implementation code for trie or any problem along with solution where you have applied trie.
Thank you

Try this one

1 Like

To do this problem ,I want to learn trie implementationπ.
But Thank you

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

typedef struct node{
node *child[26];
ll ct;
node(){
ct=0;
for(ll i=0;i<26;i++) child[i]=NULL;
}
}node;

void build_Trie(string str,node *root){
string temp="";
ll n=str.size();
for(ll i=0;i<n;i++){
temp+=str[i];
temp+=str[n-i-1];
}
str=temp;
for(auto ch:str){
if(root->child[ch-βaβ]==NULL) root->child[ch-βaβ]=new node();
root=root->child[ch-βaβ];
root->ct++;
}
}
void solve(string *arr,ll n){
node *root=new node();
for(ll i=0;i<n;i++) build_Trie(arr[i],root);
}
This is the simple and smallest method to build a trie.try to understand and start with basic application of trie

1 Like

Brother ,Thank you so much