can someone share other implementations of trie ?
since here we have lot of pointers with value as NULL... so wasting some
space
On Fri, Dec 28, 2012 at 2:52 AM, Aditya Raman adityarareloa...@gmail.comwrote:
@Sachin :thanks man i just tried to change the code with focus on
Hello everyone,
I was trying to implement Trie in c++ for the first time and got some
issues in coding its implementation.
The code has 2 commented lines namely cmnt1 and cmnt 2.
I dont understand how does it make a difference if i use cmnt1 instead of
cmnt2 .
Both lines are intended to check if a
executed your code..working fine by commenting cmnt2 and un-commenting cmnt1
--
Hi Aditya,
In C++ member variables gets initialized to garbage values. So in
child function T-Symbol is garbage and is not null so it returns because
of null check. Next in your insert method you try to access that garbage
value. This will cause a crash.
When you remove the cmnt1, you
@Sachin :thanks man i just tried to change the code with focus on
initializing NULL values to child pointers array (TrieNode-symbol in this
case) and it just works fine.
@Atul : thank you for trying to run the code. Actually the IDE i use
preferably is DEV-c++ which had the problem i