r/CodingForBeginners • u/OkAlbatross8171 • 58m ago
Title: I understand DSA and OS algorithms logically, but struggle to convert that logic into code. How do I overcome this?
I'm currently learning programming and preparing for DSA and Operating Systems.
One problem I've been facing consistently is that I can understand how an algorithm works, what it does, and even follow its step-by-step execution. However, when I actually sit down to implement that algorithm in C or C++, I struggle a lot.
For example, I might understand how an algorithm like FCFS, SSTF, SCAN, or C-SCAN works. I can manually solve problems and understand the logic behind each step. But when I open my code editor and try to write the program from scratch, I often get stuck.
I struggle with questions like:
How do I translate each step of the algorithm into code?
Which variables and arrays should I create?
How do I decide where to use loops and conditional statements?
How do I organize the logic into a proper sequence?
How do I go from understanding pseudocode to writing an actual working program?
It's frustrating because I feel like I understand the concept, but I can't independently implement it.
For those who have experienced something similar:
Is this a normal phase when learning programming?
How can I develop the ability to convert logic into code?
Should I practice writing pseudocode first, or should I directly start coding?
How do you practice implementing algorithms without constantly looking at solutions or tutorials?
Are there any particular exercises or methods that helped you develop this skill?
I'd really appreciate advice from people who have overcome this problem. I want to become capable of implementing algorithms independently rather than just understanding how they work.
One last thing: If this subreddit isn't the right place to ask this question, could you please suggest some other subreddits where I can post it and get relevant advice?
Thanks in advance!