r/learnprogramming • • 14d ago

Topic: algos Do you know algos so much?

Hii guys 🤘

I always have some troubles with algorithms and sometimes it makes me feel that programming it isn't for me. 😥

I'm a full-stack JS (React/Node) develor and I have 2.5+ years of experiecne. I've done a lot of features and made a lot of good decisions. I started programming when enrolled a uni and I'm obsessed with that from those days. I like full-stack cuz I always can do a full app without someone and I know the best practices for the both parts.

So I always hard with myself because of algos, I really don't have "mathematic thinking" and it makes me frustrated somtimes. I always think straightforward, I have not ideas how to solve a problem by a good way like from the other side yk. And I tried to solve some tasks on leetcode cuz an AI told me that it's just experience and I jsut need to know typicall patterns, and probably it helped a little but I couldn't change my mind and I gave up 😓 .

I rate myself around middle (beginner) but I really struggled with algos and I can't understand what's the problem - me or just experience. Cuz sometimes it affects on my job, for example when I need to create some algo it takes a while to write real good but not brute-force solution yk. 😖

One of my friend has such a good math thinking and I always compare myself with him, it's not so hard for him to find a way to solve some problem. He can resolve medium tasks on LeetCode without a lot of problems as me. Probably each medium task took a lot of my time. 😭

Guys how're ur deals with algos lmk pls. And pls share ur experience and stack. If u have some advice I'd be glad to give it from u. Thanks for advice 🙏

Peace ✌️

3 Upvotes

19 comments sorted by

5

u/Available_Safe1818 14d ago

What are you talking about? What kind of "algos" do you mean? Is this just normal programming?

3

u/Ok-Explanation9697 14d ago

Idk a lot of but I meant just about algos which u can find on LeetCode.

2

u/BranchLatter4294 14d ago

Learn how to think about the IPO model. Every program or function has inputs, processes, and outputs. It's just a matter of figuring out how to turn inputs into outputs using a few basic building blocks... Sequence, selection, iteration...

1

u/Ok-Explanation9697 14d ago

ye and tht's the problem. My brain always comes up with some straight, stupid, and slow idea hehe

3

u/BranchLatter4294 13d ago

The first idea doesn't have to be your last one. As long as it works, you have solved the problem. You can always go back and optimize your code.

1

u/Ok-Explanation9697 13d ago

ye agree but what about a tech interview with a life-code section where u have to be quickly and smart about tht

2

u/BranchLatter4294 13d ago

You will get there...if you practice.

1

u/Ok-Explanation9697 13d ago

Do u have good knowledge about algos? If yes so did u train it and how?

2

u/BranchLatter4294 13d ago

Mainly, I just practiced. I really got into programming because I was bad at math. I would write programs to solve my homework assignments. In the process, I learned how to program, and how to do the math.

1

u/Ok-Explanation9697 13d ago

wow, really interesting story :)
can u solve a medium task on LeetCode easily?

2

u/BranchLatter4294 13d ago

I'm too busy with work, so haven't really tried...but probably.

2

u/Creepy_Purchase_501 14d ago

Everyone’s first idea is stupid. Accept and expect that it always will be, and that it’s not a bad thing.

You’re getting pretty standard boring answers here, so I’m going to go against the grain: what you really need is playfulness and curiosity.

Think back to when you were a young child exploring the world around you. You didn’t stress out about getting things, about memorizing, learning, or getting things right. Instead you just did whatever popped into your mind and saw what happened, and if you liked it, you did more of it, and if not - you changed course.

Say you got a new ball. You’d drop it to see how it bounces. If it doesn’t, you’d investigate why. Is it the surface of the floor? Did you not throw it hard enough? Is it the ball itself? You try out all the possibilities until you determine the cause, and once you do, you start thinking of all the things you could do with it given what you know. If it’s not bouncy, but big maybe you can play soccer with it. If it’s pretty bouncy in general, but won’t bounce off the carpet, maybe you can bounce it off the wall? Endless possibilities!

Math, and, by extension, programming requires you to do the exact same thing. All you have to do is play around with the toys in a given box(problem) and explore how things fit together and how they don’t. Try an approach, and if it doesn’t work - investigate why. Would it work if you change this thing? How about that one? What do the individual pieces do if you take them apart?

Every step should paint a clearer picture of the problem and lead you to a solution. Many will be dead ends, but those teach you something too. You will also learn to recognize patterns from experience. Just how you learned that an orange ball with stripes will (almost) always be bouncy, you will learn that many problems that have the same characteristics will have the same type of solution.

1

u/Ok-Explanation9697 14d ago

Thankss u so much for this answer. It makes sense 🙏 I just need to buy some time to improve my knowledge here.

2

u/Droidatopia 14d ago

This answer to this is very much an it-depends kind of answer. I'm a non-stack developer, and I've worked in a variety of different domains. For the most part, understanding algorithms is much more important than being able to implement them or math them.

There are some basics. You shouldn't be doing a very large number of n2 lookups when you can cache the lookups in a hashtable first. If you don't grasp the basic concept of these simple algorithm considerations, you do need to learn those basic concepts or you will have issues.

Other than that, there have been occasional optimization cycles where I've had to crack open more useful algorithm knowledge to fix some slow processing.

I've also done a little advanced-math algorithms like implementing a tracking Kalman filter. That isn't something I knew how to do, so I just read dozens of research papers to try to speed-run the math involved.

To me, of far more importance is a solid grounding of how to use and apply good software patterns.

2

u/Ok-Explanation9697 14d ago

okay, thanks for ur answer. I'll keep it in mind 🤞

3

u/grantrules 14d ago edited 14d ago

Yeah, half the battle is knowing that there's already a solution to you problem. The second half is figuring out which that solution is.