Answers.Body: <p>In fact you are adressing an important issue: You were learning concepts, but you are unable to transfer the concepts to real world problems. This is a major issue in many higher education scenarios and e.g. my students always complain, that they do not find the answers to my question in the course material. Of course they don't, otherwise I would not have to ask the question - I assume they are capable of reading and writing ;-).</p>
  
  <p>Now how can you come to that next level of understanding? The answer once again is practice! You have to understand the underlying structure of a problem (e.g. use a divide and conquer approach to decompose the problem) and build a solution based on well-known blocks (like DFS / BFS, sorting, ...). The final step is to adapt the algorithm to your data structures or other specific needs of your problem.</p>
  
  <p>You have to do this over and over again to get practice. Often it helps if you are trying to understand how others did if for some problems, and websites like Codeforces can give you good examples of problems. </p>
  
  <p>After some practice, you will have gained a good intuition on how to decompose a specific problem. Especially for trees and graphs it is always helpful to draw your data structures and think about how an algorithm would traverse the data structure. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-11T11:15:17.800Z
Answers.Text: Any references for learning the implementation?
Answers.UserDisplayName: asn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-18T18:42:44.437Z
Answers.Text: @jay rosetta code is a good resource. You can google for more.
Answers.UserDisplayName: Jared Smith
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-11T11:04:26.167Z
Answers.LastActivityDate: 2019-01-11T11:04:26.167Z
Answers.UserDisplayName: OBu
Body: <p>I learnt about trees and graphs from my textbooks (undergraduate level) last year.</p>
  
  <p>But now I'm doing competitive programming and unable to solve questions involving these concepts. </p>
  
  <p>I fail to understand that a given question needs DFS or BFS for solving. I know these algorithms, but when it comes to questions which don't directly mention that DFS/BFS should be applied then I'm unable to solve them.</p>
  
  <p>I always run away from these questions because I just know the concepts but fail to reproduce them in my code and have just learnt and never coded.</p>
  
  <p>Can anyone help me in suggesting the path that I should follow to learn to solve such questions that appear in programming competitions like "Codeforces"? </p>
  
  <p>Please, provide any references such as videos or any site for noobies.</p>
  
Tags: <self-learning><algorithms><data-structure>
Title: How to learn to solve trees, graphs questions for competitive programming
ThreadText: # How to learn to solve trees, graphs questions for competitive programming
  
  (Asked by: username_0 on 2019-01-11)
  
  I learnt about trees and graphs from my textbooks (undergraduate level) last year.
  
  But now I'm doing competitive programming and unable to solve questions involving these concepts.
  
  I fail to understand that a given question needs DFS or BFS for solving. I know these algorithms, but when it comes to questions which don't directly mention that DFS/BFS should be applied then I'm unable to solve them.
  
  I always run away from these questions because I just know the concepts but fail to reproduce them in my code and have just learnt and never coded.
  
  Can anyone help me in suggesting the path that I should follow to learn to solve such questions that appear in programming competitions like "Codeforces"?
  
  Please, provide any references such as videos or any site for noobies.
  
  **Tags:** self-learning, algorithms, data-structure
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-11. Score: 3
  
  In fact you are adressing an important issue: You were learning concepts, but you are unable to transfer the concepts to real world problems. This is a major issue in many higher education scenarios and e.g. my students always complain, that they do not find the answers to my question in the course material. Of course they don't, otherwise I would not have to ask the question - I assume they are capable of reading and writing ;-).
  
  Now how can you come to that next level of understanding? The answer once again is practice! You have to understand the underlying structure of a problem (e.g. use a divide and conquer approach to decompose the problem) and build a solution based on well-known blocks (like DFS / BFS, sorting, ...). The final step is to adapt the algorithm to your data structures or other specific needs of your problem.
  
  You have to do this over and over again to get practice. Often it helps if you are trying to understand how others did if for some problems, and websites like Codeforces can give you good examples of problems.
  
  After some practice, you will have gained a good intuition on how to decompose a specific problem. Especially for trees and graphs it is always helpful to draw your data structures and think about how an algorithm would traverse the data structure.
  
  > **Comments:**
  > **username_0**: Any references for learning the implementation?  
  > **username_2**: @jay rosetta code is a good resource. You can google for more.  
  
  ---
  
  