We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20
Introduction….
basic structure:-
Q)Implementation of Trie data structure:-
There are 2 ways :- 1)Creating a node in which we will have a hashmap in which a character and node will be placed 2)using a node in which we will have a character , an array of node of 26 length and a flag is end(will use this implementation) Balki there is no need to store the character …..kyunki jo array hai har node pe 26 length ki vo 26 characters ko he batata hai ki is node ka connection ki skis character ke sath hai…to will not need the character variable with each node Q) Design Add And Search Words Data Structure:-
To bs search function ko modify karna hai taki ‘ . ’ ko handle kar le…
matlab jab dot ho to sare non null character index pe current character pe call lagayenge recursion me ..or agar vo true return krega to return kr denge true Q)Word Search 2 using trie:- There is a count optimization to ignore the leaf nodes ones they are explored but that does not work on some test cases in leet code so have to remove it in below code:- Q)Replace Words:-
Brute Force ways:-
Used way using trie:-
Q) Maximum Xor Of Two Numbers In An Array:- Q)Count Pairs With xor in a range(Quite difficult)
Basic implementation:- Q)
Implementation using trie data structure:-
Q) Concatenated Words:-
Implementation:- 1->Brute force
Better below:- Q) Longest Word In Dictionary:- Q) Stream Of Characters