HACKER Q&A
📣 Data003

Been coding for 3 years, but algorithms & DS still feel like a chore


I've been coding for 3 years, but algorithms and data structures still feel like such a chore. Anyone else been there? What finally helped you get into them? Is it worth it, or not?


  👤 gus_massa Accepted Answer ✓
99% of the real work is connecting pipes. If you can, just connect pipes until you need algorithms and structures.

* Understand the O(N^x) notation. You must understand when a program will be fast or slow, when you can just code it or when you need a library. I refuse to implement a sort function that is harder than bubble sort. If it's small and weird I use bubble sort. If it's big and standard I use sort from a standard library. You don't have to be able to program a good sort function, just know they exist and why you should use it.

* In Python, remember that implementations in library are much faster than writing your own implementation using a few `for`s. Much faster, like 10 times faster for silly loops, and even more if the library is using something smart under the hood.

* Why are you studding algorithms and data structures? Are you in the university? At work? At work you can probably delay it until they click. At the university they are part of the standard courses and you must learn them to continue.

* Anecdote time: A few years ago for the Racket compiler I had to use some weird structures (that I didn't implement), modify them slightly and use them in an unexpected way to transform a O(N^2log(N)) to a O(Nlog(N)^2). For N=1000000 that is like 20000000000000 to 400000000, i.e. it the program does not finish in your lifetime to it finish instantly. (In most cases N is not so big, so the improvement is usually not so huge.)

* Anyway, algorithms and data structures are important, but most of the time you can just connect pipes and hope it's good enough. But you must understand when you can just use the simple method and when you must use more advanced tool.


👤 tightbookkeeper
If you’re talking about the course where you write a linked list, hash table, quick sort, etc. That’s pretty basic and fundamental stuff. And I don’t know why you would like programming.

If you’re talking about the course where you prove the runtime of an algorithm using mathematical induction techniques, well that’s more of interest to mathematicians and researchers. Learn what you can, know where to look back if needed, but it’s ok.


👤 brudgers
If you don't like data structures and algorithms, you don't like data structures and algorithms. If you don't like the work required to learn hard things, that's different. While three years is a long time when a person is school-age, three years is only a short fraction of adulthood and only a brief period for a life-time learner.

Learning as an adult feels hard and the experience consists of not knowing much against an adult standard. Good luck.