Read books; follow the worked out examples very closely until you completely understand them. Then try programming it on your own from your understanding and memory. You have to put in the time and effort. I suggest studying books where complete implementations are given in a language of your choice and only later studying books with pseudo-code (i.e. go from specific to general). Also the chosen language should be simple without obscuring the core logic in OO/Functional syntactic sugar and structure (C is ideal here). The following are a few chosen books from my collection (used copies of all can be had for cheap online);
1) Data Structures and Program Design in C by Kruse, Leung and Tondo.
2) Algorithms in C (Parts1-4 and Part5 two-volume set) by Robert Sedgewick.
3) Compared to What? An Introduction to the Analysis of Algorithms by Gregory Rawlins.
4) How to think about Algorithms by Jeff Edmonds.
5) Advanced Data Structures by Peter Brass.
Finally, study the ideas, concepts and techniques behind the C++ STL library to see how to design Data Structures and Algorithms in a clean and independent manner and yet can couple them as reqd. in myriad ways for actual usage.