Algorithms and Data Structures Explained and Implemented in JavaScript
1–10 of 45 posts
Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#2Having said all that: The algorithms I've had to tackle at work tend to be fairly trivial or total one-offs involving scheduling events in human time.
How much algorithmic work do you other JS folks end up doing?
Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#3Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#4This repo is beautiful. The README is detailed and clear, and the contents seem pretty exhaustive. As a native JS guy I'm especially excited to check out the implementation of non-tree graphs! Having said all that: The algorithms I've had to tackle at work tend to be fairly trivial or total one-offs involving scheduling events in human time. How much algorithmic work do you other JS folks end up doing?
I recently built a questionnaire/form editor/builder which relies heavily on tree structures. I ended up writing a lot of tree walking code. It was the first time I've ever needed to implement interview-like questions in an actual project.
I make heavy use of functional programming in Javascript, which lends itself to really clean implementations of algorithms like tree walking, e.g.: https://hastebin.com/qapawepavi.js
Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#5Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#6Nicely done
Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#7Every library I looked at had implementations revolving around nodes that stored chars (you know, for auto-complete scenarios) but nowhere in the definition of a Trie is it bound to such an implementation (so I thought).
Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#8Tangential, but is there a name for a Trie that isn't for string searching/matching? I've had a need for this in the past but each node needed to store a non-character value. This was to facilitate a sort-of path finding where the input was matched against a known set of paths. Every library I looked at had implementations revolving around nodes that stored chars (you know, for auto-complete scenarios) but nowhere in…
It shouldn’t be too hard to roll your own here, it’s just a set of tree traversal functions.
Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#9Tangential, but is there a name for a Trie that isn't for string searching/matching? I've had a need for this in the past but each node needed to store a non-character value. This was to facilitate a sort-of path finding where the input was matched against a known set of paths. Every library I looked at had implementations revolving around nodes that stored chars (you know, for auto-complete scenarios) but nowhere in…
I've implemented at least 5 different generic Tries since this one. The idea is almost always the same, but different tradeoffs can require different implementations. While I don't recommend that you use this version, the contents of [1] should give you all the inspiration you need to roll your own.
[1] https://github.com/superlopuh/SuperTrie/blob/master/SuperTri...
Re: Algorithms and Data Structures Explained and Implemented in JavaScript
#10Tangential, but is there a name for a Trie that isn't for string searching/matching? I've had a need for this in the past but each node needed to store a non-character value. This was to facilitate a sort-of path finding where the input was matched against a known set of paths. Every library I looked at had implementations revolving around nodes that stored chars (you know, for auto-complete scenarios) but nowhere in…
I think that is just the common use case. It shouldn’t be too hard to roll your own here, it’s just a set of tree traversal functions.