跳转至

24 Conclusion

Congratulations! You’ve made it to the end of the book. You have a solid foundation now in data structures and algorithms. Even so, there’s still a lot more to learn. Don’t let that scare you, though. Each new data structure and algorithm will be its own adventure.

Approaching a Difficult Problem

At times, you may not even know what data structure or algorithm you should use to solve a particular problem. Here are a few ideas to help with that:

  • Draw a diagram to model the issue.
  • Talk through the problem with another developer.
  • Just get started by writing some code that “works”, even if it’s horribly slow and inefficient.
  • Analyze what the time and space complexity are of your current implementation. How could they be improved?
  • Step through your current implementation line by line in a debugger. This often shows you useless tasks that your algorithm is performing.
  • Keep reading and watching videos about data structures and algorithms that you’re unfamiliar with. The more you know, the more naturally a solution will pop into your head when you come up against a hard problem.

Learning Tips

Whenever you hear about a new data structure or algorithm that you’d like to learn, here are some steps you can take to maximize your learning experience:

  1. Try to get an intuitive grasp of how the data is structured or how the algorithm works. Find illustrations or videos that describe it well. Draw yourself pictures or manipulate objects such as playing cards.
  2. After you understand the data structure or algorithm on a conceptual level, try to implement it in code by yourself. Don’t look at other people’s implementations just yet. Imagine that you’re a computer scientist in the 1950s!
  3. Finally, check out the implementations in other languages like C or Java or Python. Then convert them to Dart.

Where to Go From Here?

Don’t know what to study next? Here are some suggestions:

  • Try out the A* pathfinding algorithm. Dijkstra’s algorithm is good for finding all the shortest paths in a graph, but it does a lot of unnecessary work if you only need the single shortest path between two vertices.
  • Visit codeforces.com and work on some problems in their problem set. Start with the easier problems and work up to the more challenging ones. Their code submission form doesn’t currently support Dart, but every problem includes example input and output that you can use to check your own solutions.

If you have any questions or comments as you work through this book, please stop by our forums at https://forums.raywenderlich.com and look for the particular forum category for this book.

Thank you again for purchasing this book. Your continued support is what makes the books, tutorials, videos and other things we do at raywenderlich.com possible. We truly appreciate it!

– The Data Structures & Algorithms in Dart team