4 ms·
It's funny, because I recently tackled this exact same problem in Python as well. And guess what my first step was? Writing a prefix tree implementation, in ord
by fferen 14y ago
It's funny, because I recently tackled this exact same problem in Python as well. And guess what my first step was? Writing a prefix tree implementation, in order to use the exact same approach the author took in C. It never seriously occurred to me to do it any other way. It may be because I recently got into C as well after spending years with only Python, but honestly I think I would have done the same thing before that; that's just how I think. So I don't believe it's the language that dictates how much you think about efficiency, it's the programmer.
- robryan 14y agoProviding you are aware of prefix trees. I guess you could come up with the idea independently but I would assume a lot of people when presented with the problem wouldn't.
- davidjohnstone 14y agoAt the end of my first year of my software engineering degree I wrote a Boggle solving program in C# using a trie. About a year later I discovered that tries are a recognised data structure and that I wasn't the first person to use one.
- heretohelp 14y agoTries are notorious for this by the way. I know a programmer who's been working in the industry since the 70s, she did the same damn thing when she was young with the same exact data structure.
- rodelrod 14y agoWell I didn't get back into C and last time I had to solve a similar problem typed: from Bio.trie import trie
- fferen 14y agoRight, if time was an issue I would have used an existing implementation, but since I largely code as a hobby I figured I may as well take the time to practice implementing stuff like this.