Ask HN: Do you use algorithms / data structures?

11 points by jyu ↗ HN
A lot of technical interviews have algorithms and data structures questions to presumably test "algorithmic thinking" or whatever. But in practice, it doesn't seem like algorithms are used for day to day web development. Besides avoiding writing n+1 queries, what other practical applications are there for algorithms and data structures for web developers?

10 comments

[ 3.2 ms ] story [ 38.1 ms ] thread
"But in practice, it doesn't seem like algorithms are used for day to day web development."

Wait, what?

(comment deleted)
So there are algorithms for sort, search, recursion, divide and conquer, etc, but a lot of the algorithms are baked into the functionality of high level languages and when you follow best practices, so you don't really need to know the algorithms to use them.

...Or am I missing something?

IMHO this is what separates a good engineer from a self thought programmer. To be a good engineer you need to know what goes under the hood which affects your decisions in critical situations. So big companies are searching for developers who have great engineering insights.

P.S: A good software engineer may also be self thought I do not want to be understood wrong.

I find that design patterns prove more useful (more of the time) in web development in comparison to implementing algorithms and data structures from scratch. High level web development languages (ex. C#/Ruby/Python/Scala/Groovy/PHP etc.) and some somewhat lower level languages (Dart, Go, C++) do provide tested algorithmic implementations and data structures through BCL's.

Implementing a Fibonacci sequence or a prime number sieve is much different than implementing e-mail scheduling component with dynamic constraints. I think the reason why Algorithms/Data Structures are important for interviews is because they show not only your level of experience with the tool-set you use, but also deeper understanding of the inner workings of said tools.

there is no secret ingredients for algorithm and data structure . previously me also think like u . but now am telling its work in only u r hard-work... wishing best for u
I totally agree with your point. It is jus that algo and ds are the best way to judge the analytical skill of a person and his ability to think in the right direction.
I would ask yourself what an algorithm really is. It's not just sorting or searching. It's really just a recipe of things to do in the order you have defined them to get an end result.

Pretty much every web dev related thing you make is an algorithm at the end of the day.

Think of something as simple as a contact form. What's the algorithm to make this work?

1. Get input from user.

2. Validate input from user.

3. Setup mail headers.

4. Setup mail message.

5. Call a send message function.

Those steps can be expanded on to handle invalid input or errors in any of the steps, etc..

Your programming language will likely have #5 done for you too, but whether or not you're the one implementing the functionality has no bearing on the situation.

It's easier to teach the material when you're dealing with basic data structures like building a stack or queue in C using an array rather than some higher level web dev task.

Btw, I'm just someone who spent a few years not taking any CS courses and then took a few online courses to learn the things you're talking about + more. It was probably the best move I've ever made.

Everything that you code can be tied to an algorithm since an algorithm by definition is a step by step instructions to do something.

data structures for web developers ? Plenty. Heck for any developers. Think about lists, maps, dictionaries, hash tables etc. They are data structures aren't they ?

When I think of algorithm, I see it as the "how", not the "what". A list of steps to get a task accomplished is the high-level "what". Somewhere in those steps you must derive the "how". Reduce those steps to a derivative formula, if you will. That piece of code is pounded, broken, rebuilt, transformed and eventually "fashioned" like coal becomes a diamond. Once "hardended" it will be code that works perfectly with any input, under every scenario. And when it's right, you'll know it, grasshopper - you will know it ;)

- The Algorithmist