Basics of trie

preview_player
Показать описание
This video explains the basics of trie about what is trie and how different operations are performed in a trie in a very high level giving the overview and making you understand the logic behind trie. We have also mentioned the uses of trie at the end of the video. The detailed explanation of each operation will be covered in my later videos so stay tuned. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
Рекомендации по теме
Комментарии
Автор

Clear and simple introduction of trie data structure thank you

abebayehujm
Автор

Shared your channel with all my classmates. They are liking it. Thanks for superb content mate.

anssha
Автор

EXCELLENT EXPLANATION . feeling sad for those who dslike video. They dont know what they are missing.

manishnegi
Автор

Sir your videos are also very ordered, structured and clean like trie. 12:10 :)

ABHISHEK-fyin
Автор

Thank you very muchh sir 👌
Your way of explaining is mind blowing!!

suchitragiri
Автор

Hi, may I ask which microphone you use? the sound quality is amazing! and this really contributes to why I listen to you

TomerBenDavid
Автор

Super but try to make some basic data structure and algorithms videos

aravindhkumar
Автор

isn't char data redundant, we can anyways get it from its parent node.

subhasishdas
Автор

can we also use class instead of structure?

AkashSingh-mbgy
Автор

I get runtime error for this implementation. please help me find out why?(works fine on my local computer but not on leetcode)

class Trie {
public:
struct node{
bool end;
node* next[26];
};
node* root;
node* getNode(){
node* temp=new node;
temp->end=false;
for(int i=0;i<26;i++)
temp->next[i]=NULL;
return temp;
}
/** Initialize your data structure here. */
Trie() {
root=getNode();
}

/** Inserts a word into the trie. */
void insert(string word) {
node* curr=root;
for(int i=0;i<word.size();++i){

curr->next[word[i]-'a']=new node;
curr=curr->next[word[i]-'a'];
}
curr->end=true;
}

/** Returns if the word is in the trie. */
bool search(string word) {
node* curr=root;
for(int i=0;i<word.size();i++){

return false;
curr=curr->next[word[i]-'a'];
}
if(curr->end)
return true;
return false;
}

/** Returns if there is any word in the trie that starts with the given prefix. */
bool startsWith(string prefix) {
node* curr=root;
for(int i=0;i<prefix.size();i++){

return false;

}
return true;
}
};

/**
* Your Trie object will be instantiated and called as such:
* Trie* obj = new Trie();
* obj->insert(word);
* bool param_2 = obj->search(word);
* bool param_3 = obj->startsWith(prefix);
*/

rajatnagpure
Автор

Which language are you using for competitive programming? @TECH DOSE

thinkverse
Автор

To implement dictionary defining char in structure seems redundant. We can also achieve the same result without defining extra data variable inside TrieNode struct.

sajidali_
Автор

sir please make a videos on suffix array

tirthsuthar
Автор

Can you give a basic practice question as well?

officialnizam
Автор

DOUBT :
Let suppose, if we have a word "bab" in a trie, and then we add "baba" in the same tre]ie. This modifies the word "bab" into "baba". Then how can we store "bab" and "baba" in a single trie.

jeyans
Автор

har baari awaaz sunke neend aajatai hai 😂

binay_krishn
Автор

Somebody please think of the "childs" !!

randall.chamberlain
Автор

you can dub the pain's voice in hindi 😁😁

sahil
Автор

"Children" not "Childs"

shazibelmas