DEV Community

Cover image for Algorithms in your smartphone
Eugen
Eugen

Posted on

Algorithms in your smartphone

Building a Red-Black Tree Interactively

I want to share with you a mobile application that can make your journey to learning Algorithms and Data Structures (DSA) faster and easier. Nowadays, we have many resources to learn DSA. Probably the most popular ones are YouTube videos. Personally, I also think that getting a first overview of a topic on YouTube is easy and useful.

As a professional developer with many years of experience, I can admit that practice is the only way to consolidate knowledge.

So, simply watching videos is not enough. Learning a complex topic like Algorithms and Data Structures requires breaking down the learning path into separate stages: first, you choose a topic, then you get theoretical information that in practice shapes your neural connections.

But how can we practice DSA? Some people suggest taking a pen and paper and looking at the code - start drawing or visualizing each step of the algorithm. Well, I did this earlier in my career, when I was looking for my first job as a software developer.

As you may have noticed, it works (I got my first job in 2012). So if you have a lot of time, go for it. However, time has gone much faster since then, or I just got older :). What I mean is that the competition for software developer jobs is getting tougher. And because of AI (or LLM, to be more precise), we have to learn much faster.

Can current "AI" solutions help improve the way we study algorithms and data structures? In part, yes. But not dramatically, since they cannot visualize (at least not yet) how algorithms and data structures work.

In addition, AI hallucinations can only be noticed by experienced programmers who are already familiar with the algorithms and have turned to AI for help only to refresh their knowledge. For beginners, this can lead to a big waste of time, since AI ​​can sometimes provide incorrect information.

I was a mathematician in the past. Maybe that's why my inner desire for knowledge prompted me to find an easier way to learn and consolidate Algorithms and Data Structures.

The idea is not new. We already have several websites that provide interactive visualization of DSA, and they are quite popular.
For completeness, I will list some of these resources below:
https://visualgo.net,
https://cs.usfca.edu/~galles/visualization/Algorithms.html

We can also mention resources that focus on visualization, but without interactivity (i.e. the user acts as a passive observer):
https://log2base2.com,
https://neetcode.io,
https://hellointerview.com

On the other hand, we didn't have good mobile solutions. I mean an application that can work offline, is easy to use, with clear explanations and visualizations. And of course, with interactivity! So I decided to write such an application from scratch.

The development of the application took several years. The application is written in Unity 3D and offers you a unique experience of studying algorithms and data structures. Thanks to Unity, the application can be installed on both Android and iOS devices.

If you are interested, you can watch a short video to see what I am talking about: https://youtu.be/oHIyzpWLZII

But what topics does this app cover? Well, these are some basic data structures like array, linked list, queue, stack, hash table, binary search trees, avl and red-black trees, graphs, Union-Find DS. This app also covers sorting (Merge, Heap, Quick, etc.), binary tree and graph traversal algorithms, as well as Dijkstra and minimum spanning tree (Kruskal and Prim) algorithms. You can also build your own graph and see how DFS, BFS, Dijkstra or MST perform on such a graph.

The uniqueness of this application is in the gradual provision of information. Each step is visualized and has its own description. Some algorithms and data structures require input values. For example, you can build your own balanced binary search tree, such as avl-tree or red-black-tree. During this process, you can see how these trees change, decreasing their height. I think it's better to see and try than to visualize algorithms in your head. I don't know about you, but for me visualizing such a complex abstraction in my head is very difficult and energy-consuming.

Since an Apple Developer account requires an annual fee and other development tools like Rider and Sketch are not free, this app provides an in-app purchase option if you want to continue learning some advanced topics to cover the annual cost. To be fair, it's worth noting that the app doesn't offer a subscription or any other hidden forms of monetization - just a small one-time fee that provides lifetime access to current content and future updates.

So far, the app has received a lot of positive feedback and I think it has helped a lot of people move forward in their career as a software developer.

You can also read more about this app on Medium.

I would like to thank dev.to for the opportunity to publish my article on such a wonderful platform.

Thanks for reading. Any constructive feedback or suggestions would be greatly appreciated. Have a nice day!

Top comments (0)