<p>You need to understand the problem the data structure is trying to solve, how it is used (algorithms around it). You need to be able to see any alternatives and their advantages and disadvantages, specially when managing lots of data.</p>

<p>You need some guide, concrete problems to solve, somebody who tells you the relevant mathematics (yes, understanding <em>why</em> one alternative is better than another is mathematics). And try your hand at writing your own programs.</p>

<p>There are many texts available for free, like the series <a href="https://opendatastructures.org" rel="nofollow noreferrer">Open Data Structures</a> (available in several programming languages, rather decent); Jeff Ericson's <a href="http://jeffe.cs.illinois.edu/teaching/algorithms" rel="nofollow noreferrer">Algorithms</a> text is very good, if somewhat heavy going; there are many sets of (more or less) polished lecture notes and textbook drafts floating around, like the <a href="http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf" rel="nofollow noreferrer">one by Dasgupta et al</a>. The classic book by Cormen et al "Introduction to algorithms" is encyclopaedic; Sedgewick and Wayne's "Algorithms" is very nice.</p>

CC BY-SA 4.0
2019-08-08T21:12:24.157Z
2019-08-08T21:12:24.157Z
vonbrand
<p>First, if you aren't taking a course, get a good book that has a lot of exercises. Use the exercises to guide your learning. Try to find a way to get some feedback on your attempts. </p>

<p>The way you learn just about anything <em>deeply</em> is to get a lot of reinforcement and feedback. </p>

<p>On the other hand, it is seldom necessary with today's languages and libraries to implement standard data structures. It <em>is</em> however, necessary to understand the fundamental of each and their relationship to various sorts of efficiencies when applied to various sorts of problems. </p>

<p>One way to get a deep understanding is to learn the technique of developing algorithms (not just data structures) from pre and post conditions. </p>

<p>My go-to book for doing that is by <a href="https://rads.stackoverflow.com/amzn/click/com/038790641X" rel="nofollow noreferrer" rel="nofollow noreferrer">David Gries</a>. It isn't cheap, but it can change the way you think about programs. I've mentioned it elsewhere here. </p>

<p>If you don't have other ways to get feedback, you might be able to form a group of like minded people who exchange work and comment on each other's attempts. </p>

CC BY-SA 4.0
2019-07-16T16:01:01.863Z
2019-07-16T16:01:01.863Z
Buffy
<p>Should one first understand its logic and see its implementation? Or should one try to implement it first oneself?</p>

<p>How should one learn so that one can quickly implement the algorithm or data structure quickly if needed? By practising implementing it repeatedly?</p>

<p>All in all, please throw light on the ways you find it efficient to learn algorithms.</p>

CC BY-SA 4.0
2019-07-19T20:11:42.533Z
Honest answer: the best way to learn to implement an algorithm or data structure quickly is to make sure you can quickly pull up the Wikipedia page on each!  Or, if you want to get straight to the punch, google [stack exchange](https://xkcd.com/1185/) for it.  (be sure to read the alt text)
Cort Ammon
CC BY-SA 4.0
2019-07-20T06:26:20.560Z
@CortAmmon Sir, what do you mean by alt text? You mean the standard books?
Sankalp1999
CC BY-SA 4.0
2019-07-20T06:33:57.980Z
Alt text is the text which appears when you hover over an image..  The linked XKCD has some relevant text.  (It's called "alt text" because in HTML, you specify it with the "alt" attribute)
Cort Ammon
<self-learning><algorithms><data-structure><active-learning>
How should one go into learning algorithms and data structures? What do you think is an efficient way to do so?
# How should one go into learning algorithms and data structures? What do you think is an efficient way to do so?

(Asked by: username_0 on 2019-07-16)

Should one first understand its logic and see its implementation? Or should one try to implement it first oneself?

How should one learn so that one can quickly implement the algorithm or data structure quickly if needed? By practising implementing it repeatedly?

All in all, please throw light on the ways you find it efficient to learn algorithms.

**Tags:** self-learning, algorithms, data-structure, active-learning

> **Comments:**
> **username_1**: Honest answer: the best way to learn to implement an algorithm or data structure quickly is to make sure you can quickly pull up the Wikipedia page on each!  Or, if you want to get straight to the punch, google [stack exchange](https://xkcd.com/1185/) for it.  (be sure to read the alt text)  
> **username_0**: @CortAmmon Sir, what do you mean by alt text? You mean the standard books?  
> **username_1**: Alt text is the text which appears when you hover over an image..  The linked XKCD has some relevant text.  (It's called "alt text" because in HTML, you specify it with the "alt" attribute)  

---

## 2 answers

### Answer by username_3 on 2019-07-16. Score: 3 | Accepted answer

First, if you aren't taking a course, get a good book that has a lot of exercises. Use the exercises to guide your learning. Try to find a way to get some feedback on your attempts.

The way you learn just about anything *deeply* is to get a lot of reinforcement and feedback.

On the other hand, it is seldom necessary with today's languages and libraries to implement standard data structures. It *is* however, necessary to understand the fundamental of each and their relationship to various sorts of efficiencies when applied to various sorts of problems.

One way to get a deep understanding is to learn the technique of developing algorithms (not just data structures) from pre and post conditions.

My go-to book for doing that is by [David Gries](https://rads.stackoverflow.com/amzn/click/com/038790641X). It isn't cheap, but it can change the way you think about programs. I've mentioned it elsewhere here.

If you don't have other ways to get feedback, you might be able to form a group of like minded people who exchange work and comment on each other's attempts.


---

### Answer by username_2 on 2019-08-08. Score: 1

You need to understand the problem the data structure is trying to solve, how it is used (algorithms around it). You need to be able to see any alternatives and their advantages and disadvantages, specially when managing lots of data.

You need some guide, concrete problems to solve, somebody who tells you the relevant mathematics (yes, understanding *why* one alternative is better than another is mathematics). And try your hand at writing your own programs.

There are many texts available for free, like the series [Open Data Structures](https://opendatastructures.org) (available in several programming languages, rather decent); Jeff Ericson's [Algorithms](http://jeffe.cs.illinois.edu/teaching/algorithms) text is very good, if somewhat heavy going; there are many sets of (more or less) polished lecture notes and textbook drafts floating around, like the [one by Dasgupta et al](http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-Vazirani.pdf). The classic book by Cormen et al "Introduction to algorithms" is encyclopaedic; Sedgewick and Wayne's "Algorithms" is very nice.


---

