Skip to main content
16 events
when toggle format what by license comment
Apr 13, 2017 at 12:40 history edited CommunityBot
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Oct 15, 2015 at 12:27 comment added Caridorc @CodeYogi I think a correcness bug (or misunderstanding of requirements) should be an answeerr
Oct 15, 2015 at 8:08 comment added CodeYogi One very important thing! the Trie is an ordered data structure hence the children should be ordered.
Oct 5, 2015 at 17:02 history edited Jamal CC BY-SA 3.0
added 65 characters in body; edited title
Oct 5, 2015 at 17:01 answer added SuperBiasedMan timeline score: 1
Oct 5, 2015 at 16:56 comment added Caridorc @SuperBiasedMan if you think about it, when I call with open("foo.txt", "w+") as f: f.write("example") there is no message printed, no pop-up, no flashing light telling me that the file has really been written.
Oct 5, 2015 at 16:53 comment added Caridorc @SuperBiasedMan in Unix silence means success.
Oct 5, 2015 at 16:52 comment added SuperBiasedMan I mean in terms of UI. The user has no idea whether insert has actually done anything after they called it unless they print t before and after. But does that matter to you?
Oct 5, 2015 at 16:51 comment added Caridorc @SuperBiasedMan what do you mean by validate? I have tests for it
Oct 5, 2015 at 16:50 comment added SuperBiasedMan Is it intended that you never validate whether or not insert has actually changed anything? Nothing different happens whether I'm adding a new value or not.
Oct 5, 2015 at 14:13 comment added Caridorc @Ivc ok, fixed.
Oct 5, 2015 at 14:13 history edited Caridorc CC BY-SA 3.0
fix
Oct 5, 2015 at 14:01 comment added lvc I think having all the prefixes show up as 'included' is actually an undesired result of removing the value - with it, you could easily have a special sentinel value that isn't normally available to clients that says "this is not an end node of any word in the trie". This would be necessary if you allowed removing items from the trie, because without knowing which words have been explicitly added, you can't tell whether trie.remove('banana') should also remove 'bana'.
Oct 5, 2015 at 12:53 comment added Caridorc @Jaime I think it should be correct, as banana contains bana, so adding banana you are implicitly adding b - ba - ban - bana - banan, it is called prefix tree for this reason
Oct 5, 2015 at 12:33 comment added Jaime It seems to me that t = Trie(); t.insert('banana'); 'bana' in t would return True. Is this really the desired behavior?
Oct 5, 2015 at 11:38 history asked Caridorc CC BY-SA 3.0