Data structures

I need help learning data structures and algorithm in dept .
Learning python atm.
I believe the reason we code is to solve problems and make life easy so i think learning how to write an effective algorithm is a need and deciding what kind of structure fits your code is an essential so any suggestions ?

2 Likes

Hey @anushkrishnav !

I think what you’re asking is along the lines of “why do we study data structures and algorithms?”

The answer has to do with a topic we see in many forms within computer science: the space-time-tradeoff. Most algorithms may be expressed in terms of space complexity (how much memory is needed to compute something) and time complexity (how long will it take).

Data structures and algorithms go together because: we can often speed up an algorithm with more complicated data structures that require more memory, or we can make an algorithm take up less memory by using simpler data structures.


To borrow an example from security: imagine you’re trying to crack a 10-character password stored as an md5 hash.

There are two options you might try:

  1. Compute the md5 hash of all 10-character permutations of [a-z,A-Z,0-9], then store the results in a database.
  2. Iterate over permutations of [a-z,A-Z,0-9] and return when one matches, or you reach 10 characters.

(1) has high space complexity since you have to store the results, but cracking a new password is easy since you only have to look up the answer in a table.

(2) has extremely low space complexity, but you may spend a lot of time re-computing results you’ve previously answered.


This example is fairly informal, but hopefully provides some intuition. Studying algorithms provides formal tools for analyzing and comparing these tradeoffs, and hopefully can help to steer us toward solutions that fit specific needs.

1 Like

would love some good reference articles and videos to learn em in-dept

Here is the crash course from Coursera. You can also apply for Financial Aid to get certificate after course completion.

good work .

thanks will check it out

2 Likes

My go-to reference is “Introduction to Algorithms, 3rd Edition” (sometimes abbreviated to CLRS, the author’s surnames). The book is used quite often, so usually you can find a cheap copy.

If you’d like a preview of some of the topics, I have a GitHub gist where I devised a divide-and-conquer algorithm and proved some of its properties.

I don’t have a favorite for online resources, but quite a few resources tend to be available from people teaching courses at various universities. This Stanford class page has slides for quite a few topics. Professor Chandrasekaran at UT Dallas currently has material from his course posted as well.

Algorithms is a big field. Depending on what you’re interested in, you might look further for: divide and conquer algorithms, greedy algorithms, dynamic programming, graph algorithms, randomized algorithms. If you want to go further into theoretical topics: theoretical computer science tends to deal with string-matching algorithms, complexity, NP-completeness, etc. I’ve been reading the online book “Introduction to Theoretical Computer Science”, and it covers a lot of these.

Thanks a lot for the effort . Will sure check em out ,Started with the MIT’s open course pretty solid Will visit your gist

© 2017 GitHub, Inc.
with by
GitHub Education