Live data from Hacker News

Algorithms

khanacademy.org

91–100 of 163 posts

Re: Algorithms

#91

Earlier quoted context omitted.

For software engineers, algorithmic complexity is a good filter for, say, Javascript hackers vs people with a university education in computer science. Just saying.

And in your mind, "javascript hackers" are worse than "people with a university education in computer science" at doing modern front-end web development? In my experience, building performant web applications is much more about things like reducing bundle size, making sure animations are hardware-accelerated, being smart about _when_ you do complex work... The cost of using an O(n^2) algorithm over an O(n) algorithm…

I'm not sure where you got the implication that one was being called out as worse than the other, but the comment is really just noting it's a way to filter out specific groups. That filter may be useless when hiring for a front-end developer, but on the other hand, if hiring a developer to work on your new database product, it may be very useful indeed. As you note, they commonly deal with different types of complexity.

Re: Algorithms

#92

Earlier quoted context omitted.

Data structures and algorithms are foundational topics in computer science. While they can seem daunting to beginning programmers, they become very important as you progress into writing more advanced programs. Also, the interview process for software engineers at most companies ask about them almost exclusively.

> they become very important as you progress into writing more advanced programs As someone with a Computer Science degree I can say that the only times I have ever used any of the algorithms I learned directly was when writing low level C and GoLang. I'm willing to bet 90% of programmers... even those that right "advanced" programs do not use them day to day. Every algorithm and data structure worth anything has bee…

I'm a self-taught software engineer and learning about data structures and algorithms has made a huge difference in my ability to deliver solid code. The basics of graph data structures and algorithms (DAGs, topological sort, BFS, connected components, etc) seem especially helpful, and it's good to have a constant awareness of the time complexity of the code I'm writing.

I'm not talking about implementing my own sorting algorithms every time I need to sort things; I'm talking about recognizing that a particular problem can be efficiently represented by data structure X and solved with algorithm Y. Hopefully I'm writing none of this code myself, but a programmer who doesn't in theory know how it all works is never going to be able to compose pre-written code into an optimal solution. I know, because I've been that programmer.

I don't know what you mean by "advanced" programs. I guess I fall within your 10% by definition, since I can anecdotally say that having and using this knowledge has made a big difference for me. I would say that I use this stuff 5% or less of my time, but for that 5% it can make the difference between run time of under a second vs. multiple days, and between a brittle, defective solution and a rock solid one.

Not to mention that it's extremely handy for getting hired in the first place, and it's just plain fun.

Re: Algorithms

#93

Earlier quoted context omitted.

I'd never heard of the expression "dynamic programming". https://en.wikipedia.org/wiki/Dynamic_programming Am I to understand that it is "just" recursion with caching?

It's just caching. Recursion not required, iterative DP solutions are things too.

Dynamic programming is not caching. Memoization is caching, the use of which is not required in dynamic programming.

Re: Algorithms

#94

Earlier quoted context omitted.

For software engineers, algorithmic complexity is a good filter for, say, Javascript hackers vs people with a university education in computer science. Just saying.

And in your mind, "javascript hackers" are worse than "people with a university education in computer science" at doing modern front-end web development? In my experience, building performant web applications is much more about things like reducing bundle size, making sure animations are hardware-accelerated, being smart about _when_ you do complex work... The cost of using an O(n^2) algorithm over an O(n) algorithm…

Where did you get the impression that GP was talking about "doing front-end web development"?

Re: Algorithms

#95

This is an excellent course and helped me get my current job. My background is chemistry/chemical engineering. I had applied for a data scientist position. Phone interview included a problem where I was asked about my solution's complexity. I admitted I didn't know about it. Still got called back for an interview on site, but the weekend before I powered through this course. Unsurprisingly, it came up in the on-site…

Python is the algorithm king as far as I'm concerned. It really gets out of your way and lets you focus on the abstract nature of what you're trying to accomplish.

Hardly. How often is it that you can read an uncommented Python program that implements a tricky algorithm, and you can easily recover basic things like loop invariants?

Re: Algorithms

#96

Earlier quoted context omitted.

And in your mind, "javascript hackers" are worse than "people with a university education in computer science" at doing modern front-end web development? In my experience, building performant web applications is much more about things like reducing bundle size, making sure animations are hardware-accelerated, being smart about _when_ you do complex work... The cost of using an O(n^2) algorithm over an O(n) algorithm…

Where did you get the impression that GP was talking about "doing front-end web development"?

Hm. Yeah, fair question. I guess I was assuming that, since the applicants could be described as "javascript hackers", then it was a JS position. Most JS positions are front-end ones.

But yeah, that's admittedly a tenuous thread.

Re: Algorithms

#97
post #91

Earlier quoted context omitted.

And in your mind, "javascript hackers" are worse than "people with a university education in computer science" at doing modern front-end web development? In my experience, building performant web applications is much more about things like reducing bundle size, making sure animations are hardware-accelerated, being smart about _when_ you do complex work... The cost of using an O(n^2) algorithm over an O(n) algorithm…

I'm not sure where you got the implication that one was being called out as worse than the other, but the comment is really just noting it's a way to filter out specific groups. That filter may be useless when hiring for a front-end developer, but on the other hand, if hiring a developer to work on your new database product, it may be very useful indeed. As you note, they commonly deal with different types of complex…

Yeah, good point. I may have been adding a tone that wasn't actually there.

Apologies if I took it the wrong way!

Re: Algorithms

#98
post #14

Another great resource I highly recommend: https://www.manning.com/books/grokking-algorithms

I didn't care for this book. I found though the use "doodle drawings" for visualization to be hard to look at and distracting. The book felt half-finished to me. For instance how does an algorithms book not include anything on trees? I think a much better and free alternative is: http://interactivepython.org/runestone/static/pythonds/index...

About the alternative, you can learn about algorithms but be prepared to not learn them in a pythonic way.

Re: Algorithms

#99

Earlier quoted context omitted.

I didn't care for this book. I found though the use "doodle drawings" for visualization to be hard to look at and distracting. The book felt half-finished to me. For instance how does an algorithms book not include anything on trees? I think a much better and free alternative is: http://interactivepython.org/runestone/static/pythonds/index...

About the alternative, you can learn about algorithms but be prepared to not learn them in a pythonic way.

I'm not sure I would say the book is "un-pythonic", but rather the book intentionally avoids overly language specific idioms in order to reduce algorithms to their most basic form. Once you have the basic knowledge its trivial to implement them in any language you want, using those language specific idioms - swaps without a temp variable or list comprehensions etc. It is not a "Python book" per se it is an algorithms book that uses Python to teach. I've seen many Algorithm book that use Java use a stripped-down back to basics procedural style as well I think for the same reason. The book also incorporate code lens and Python Tutor so you can step through your stack frames and pause execution. This is a wonderful teaching aide, especially for things like recursion.

http://www.pythontutor.com/

Re: Algorithms

#100
post #8

Earlier quoted context omitted.

Datastructures are akin to tools, and Algorithms are like plans. You need to use the tools to implement the plans for building your desired result. Each "tool" you learn inside and out allows you to build something new. The better you learn them, the more you can build.

It's a better explanation than mine.

I played with legos far more than is healthy as a child, and grew up to be a software engineer :)

Can't help but think of it in literal lego terms.

Post reply on HN