Data Structures and Algorithms

Pho3nix

The Legend
Joined
Jul 31, 2009
Messages
32,825
Reaction score
3,033
Location
On the toilet
Hi everyone,

So looking to move companies and figured I should start working on the above. Does anyone have any tips, books or tricks to jump start my brain. Been a long time since I did some of this as it wasn't part of the job per se. Registered on Leetcode and Hackerrank to practice their stuff but curious if anyone can give some tips.
 
I’m in the same boat, Hackerrank is a good start hey. Then you might also want to look at some system design books.
 
Hackerrank and leetcode. What else do you want. You are procrastinating.

850ff03095c99048708074cb1b3a3615.gif
 







--

Not sure what you know. Just pasted a few that you could dive into. More theory than raw coding.
 
I want someone to tell me WTF any of this will have to do with the job lol.
It might help you avoid writing **** code. What is **** code you may ask. **** code is expensive. It uses up too much of resources when it doesn't need to. It slows everything down. **** code can be fast but it might still be **** code if nobody can read it. People need to read it because it will definitely be updated at some point. Don't write **** code.

NB. I'm joking but very serious
 
In terms of resources, you may want to check out the IOI and even SA Olympiad site. HackerRank, LeetCode, TopCoder, etc. are all great exercises.
 
I want someone to tell me WTF any of this will have to do with the job lol.
There are actually jobs, where developing algorithms is a large part of the work. :)

There are certainly companies that want you to know how these work (so you understand the choices and tradeoffs at least), even if you don't ever implement them. For other companies, it's more of a calibrated benchmark, or even a type of developer IQ test (and yes, like IQ tests, it doesn't necessarily mean you can do the job well, although it is certainly indicative).
 
There are actually jobs, where developing algorithms is a large part of the work. :)

There are certainly companies that want you to know how these work (so you understand the choices and tradeoffs at least), even if you don't ever implement them. For other companies, it's more of a calibrated benchmark, or even a type of developer IQ test (and yes, like IQ tests, it doesn't necessarily mean you can do the job well, although it is certainly indicative).

Problem is that these days more and more companies that do not use traditional CS algs and data structures are trying to emulate the hiring practices of FAANG etc by asking ridiculous questions that have nothing to do with the job. Fair enough, if the role requires deep understanding of these concepts, then absolutely, but please, if its some insurance company asking this and requiring me to grind 2342342942 LeetCode problems for preparation, they can get rekt.

More on topic though, Cracking the Coding Interview and Elements of Programming Interviews in Python (there is a Java and C++ version) are good books.
 
I would recommend "Introduction to Algorithms" by T. Cormen, et. al. It provides comprehensive coverage of the landscape and structures that you will encounter which are derived from first principles, escalating in complexity and finalising by providing supplementary theoretical material to solidity ones' understanding. Aside, it's a genuinely enjoyable read and reference point if you're inclined towards more technical material.
 
In terms of resources, you may want to check out the IOI and even SA Olympiad site. HackerRank, LeetCode, TopCoder, etc. are all great exercises.

My personal fav for beginners: https://projecteuler.net/
 
In terms of data structures, well there's so many books that offer wonderful insight on the topic. And yes, I'm suggesting a book that you hold in your hand.
From personal experience (assuming you have at least some knowledge on computer programmming - i.e. the absolute basics) I would suggest understand these following structures. Dont worry too much if you cannot remember the details offhand but rather know how the internals work. In no particular order.:

Linked list, or lists in general.
This structure is very important as it is used for just about everything. from how your data is stored in databases, to things like ... graphical user interface components like the tree view. It comes in many variations.

Arrays
more basic concept than lists, but can get bit confusing once you add too many dimensions and if they jagged or straight e.g. 2d arrays etc. Fyi.. if you thinking of going .net route arrays (or rather the one from the older framework) are blindingly fast ;)

Actual Data Structures that holds e.g. business data
Start with structs , then before you jump to classes, learn interfaces


Algorithms
The only worthwhile advice I can give here is , algorithms generally fall into various categories. e.g. Searching, Sorting, Updating, Caching etc etc, and most literature starts off with sort and things like bubble sort etc,
but before you do anything else,
try and visualize or see how you would do the thing if it wasn't invented yet. Dont stress too much if you cannot find a self satisfactory answer. Far better computer scientists all sucked at some point as well.

Oh.. last thing, when you more confident in your computing, don't be afraid to dig deep into code and see how things are built. Its very interesting.

M
 
A couple months later and still struggling albeit not getting as much time to go through the stuff.
Window Sliding Technique question left me very lost but really guys half of this hasn't shown up in all my years so far.

/Goes back to Hackerrank
 
A couple months later and still struggling albeit not getting as much time to go through the stuff.
Window Sliding Technique question left me very lost but really guys half of this hasn't shown up in all my years so far.

/Goes back to Hackerrank
You’ve self selected against this. One you learn the stuff, you can apply for a wider range of jobs, including those where these things shop up more often.
 
You’ve self selected against this. One you learn the stuff, you can apply for a wider range of jobs, including those where these things shop up more often.

True true. Just frustrated at the moment at my inability.
 
True true. Just frustrated at the moment at my inability.
I was also a bit worried when I was studying up for my current job. Working through a bunch of exercises eventually got me just as fast as I was 15 years before.

If you’re not familiar with the data structures and algorithms, it may be better to read through a book on them before just churning exercises. The exercises alone show you “oh, that’s a neat way to solve that”, but typically don’t discuss or prove things like complexity or optimality, which is key to really being able to choose the right tool for the right job.
 
I was also a bit worried when I was studying up for my current job. Working through a bunch of exercises eventually got me just as fast as I was 15 years before.

If you’re not familiar with the data structures and algorithms, it may be better to read through a book on them before just churning exercises. The exercises alone show you “oh, that’s a neat way to solve that”, but typically don’t discuss or prove things like complexity or optimality, which is key to really being able to choose the right tool for the right job.
I had gone through this
but I think a book would be a more ideal tool so I can reference back.

Some recommendations above I'll look at. Anything @cguy you'd recommend?
@semaphore you haven't led me wrong so far either
 
Top
Sign up to the MyBroadband newsletter
X