5 ms·
You likely won't be writing many algorithms or data structures from scratch. You'll be implementing them, though! In practice, you'll be so busy seeing the for
by git-pull 9y ago
You likely won't be writing many algorithms or data structures from scratch. You'll be implementing them, though!
In practice, you'll be so busy seeing the forest for the trees, tackling the business case at hand, you'll rarely be fussing over textbook definitions.
Often, when I see someone focusing too much on book smarts and interviewing in itself it's a sign they may need to put their reading and memorization into practice more. This is why I'm skeptical of job interviews - these things cater toward those who memorize them (likely fresh out of college), not devs on the field of battle shipping stuff for a few years.
Memorizing arbitrary stuff out of a text book when you have libraries already there and deadlines? Come on. In the rare event you need to write your own thing, you'll ask the manager for time to clear up airspace and study not from the textbook, but other's successful implementations, at a time when it actually matters.
Here's how I'd improve it: find implementations of linked lists, queues, stacks, graphs, and whatever in programming languages, their standard libraries, and community frameworks. Show people the utility, have them conceptualize it internally, rather than memorize it.
Here are some off the top of my head:
Something broad and standardized, templated containers of data structures, like C++'s stdlib and its vector, map, and so on. Last time I checked chromium's source tree, std:: was everywhere: https://cs.chromium.org/search/?q=std::+package:chromium&sq=package:chromium&type=cs https://cs.chromium.org/search/?q=std::+package:chromium&sq=...
Something low-level and cool, like Python's timsort: https://svn.python.org/projects/python/trunk/Objects/listsort.txt https://svn.python.org/projects/python/trunk/Objects/listsor.... (Java actually ended up borrowing that: https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/java/util/TimSort.java https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/...)
Something high-level, for instance, django-treebeard's approaches toward handling hierarchies in Django. In this package, adjacency lists (https://en.wikipedia.org/wiki/Adjacency_list https://en.wikipedia.org/wiki/Adjacency_list) are carried over not just to relational databases, but an ORM system. (https://django-treebeard.readthedocs.io https://django-treebeard.readthedocs.io)
- thomastjeffery 9y ago> find implementations of the concepts of linked lists, queues, stacks... I would venture to say that you will likely never implement a 1-dimensional data structure. Those will exist in the standard library, or even in the syntax of the language itself. What would be helpful practice is to implement more complicated data structures like trees, graphs, associative arrays, etc. for several different languages, and find out which methods are the clearest, the fastest, and the easiest to implement in each given language. The other thing to focus on is everything used to go from source code in a file to a binary running on a user's system. There are interesting problems that practically no one teaches to "beginners", like foreign function interfaces, package management, signatures, etc. that are just as important to understand as tree traversal algorithms.