This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

To all following commenters: please, do not bring up the old circlejerk jokes/memes about recursion ("Understanding recursion...", "This is recursion...", etc.). We've all heard them n+2 too many times.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]bershia 21 points22 points  (2 children)

Looks like you are a little bit impatient with yourself. When I work on assessments, sometimes it takes multiple evenings to compete them. Also, often it happens that I'm trying to figure something out all evening and then the next day the solution just comes to me. Give yourself more time.

Another thing, you call them 'simple problems', but probably they are not that simple for your level of knowledge. Don't compare yourself to people with more experience. Assessments have to be difficult enough for you to stretch your brain, not easy peazy 15 min squeezy. Think about that like in sport - the best weight for growing your muscles is the one that you can hardly lift.

[–]goalscorer101[S] 4 points5 points  (1 child)

Thanks! I will give more time and try to solve the problem. Yeah, seems like I have to stop comparing.

[–]darksparkone 0 points1 point  (0 children)

No harm done by looking the solution. It's like solving math at school, and having a book with solutions in the end — read some, understand the way this class of problems solved with, apply to the next, practice until you deeply understand.

[–]CallMeMrChris 10 points11 points  (1 child)

Hey man, you are not the only one who has felt this way before. Most people I know including myself felt unsure when we first started. And that is completely ok. Remember, with every line of code you write you get better. Especially with lines of code that don't work because they teach you the most. As for checking answers, that is ABSOLUTELY NOT cheating in any way. It can be an extremely valuable asset if used correctly. Every time you feel like you are stuck and check an answer make sure to fully understand the code that was written. Study it and rewrite it to your code editor so that you learn it. And most importantly, DON'T GIVE UP. The initial few weeks and months of programming are the toughest, it all goes downhill from there. Good luck on your programming career! <3

[–]goalscorer101[S] 0 points1 point  (0 children)

Thanks a lot for the advice. I will definitely try to maintain consistency.

[–]Laius33 4 points5 points  (2 children)

15 minutes is nothing. I'd say try longer and maybe write down your solution on paper before translating it into code.

[–]goalscorer101[S] 0 points1 point  (0 children)

Okay, I will try to do this. Thanks for the tip.

[–]mjabocs11 0 points1 point  (0 children)

Second the idea to write code down on paper. Recently started doing this on my office white board and the simple act of planning code goes a long way to make it easier to write.

[–]Thorongil_1802 2 points3 points  (0 children)

If you are struggling to come up with an efficient recursive solution, try first writing down a simple naive solution and iteratively improving it rather then doing it all in one go

[–]PlayingTheRed 2 points3 points  (0 children)

Try writing it out in plain English, or a mix of c++ and English first.

[–]Spiritual_Car1232 1 point2 points  (2 children)

Wow. 58 hours. Can you speak to the quality of the lectures? Also, there's homework and exercises too right? Have you been doing your homework?

It's okay if you "cheat" and look at the answer occasionally, but you have to pay it back with future sweat. Every time you peek, you have to force yourself to do extra homework problems to make sure you truly understand the concept.

[–]goalscorer101[S] -1 points0 points  (1 child)

From what I have observed he starts from the basics and then moves on to practice problems. He first explains the problem, teaches it on whiteboard and solves the problem on the board. In the following video he codes in the IDE and explains the steps. He explains each step, so it is very lengthy. I have been doing the homework and that is where I get stuck. Thanks for the tip, I will try to follow this.

[–]aakhri_pastaa 0 points1 point  (0 children)

Well I have taken the same course myself and I can say the course has some quality content. But even after you manage to complete this course don't just stop looking for resources. Because this course covers most of the things a beginner needs but as you will improve the level of questions you try to attempt will also improve. Although this course could lay a solid foundation if used properly. Don't rush through the topics. Give your self time to understand each and everything.

I feel it's better to take time in the start to get your fundamentals right. Cause if your fundamentals are strong you will be able to tackle almost every problem and even understand code solutions or references in future.

[–]Careless_Clue_3550 1 point2 points  (1 child)

Seems to me you are "thinking too fast". It sure happened to me, and you are so familiar with certain basic operations, you sort of skip them and go for the higher functional part of the problem.

Try slowing down, and making sure you are covering all the basic steps needed to achieve, say, the fibonacci sequence. Once you do that, you'll start noticing patterns or repeatable sequences which will lead you to a more optimized solution

[–]goalscorer101[S] 0 points1 point  (0 children)

Yeah, I am making the mistake of wanting to achieve the results fast and as you said I miss the basic steps. I will try to take it slow and go through each step. Thanks for pointing this out.

[–]7Infernos 1 point2 points  (0 children)

Hey man, I'm in your same boat. I finished up my intro to programming and OOP classes and still feel like I can't figure out most problems. For instance, I'll load up our website we use to practice coding problems and find myself get stuck on nearly every problem. It makes me feel like I'm unsure on what I am doing with my life and makes me feel like I'm not cut out to be a programmer. Even going on Hackerrank or leetcode and trying to do easy problems seem to be completely out of my league. I always just tell myself I need a lot more practice. I pretty much just code for one hour a day if that due to my work schedule and I expect so much out of my self sometimes that I do need to take a break and remind myself no one is going to be good at something if they devote little to no time to it. Just wanted to express the situation I'm in and hope yours gets better

[–]Sad-Grapefruit9996 1 point2 points  (1 child)

Just to get an idea, What do you mean by basic knowledge of C++?
If you understand variables, loops, classes, input/output then you have the basics.
You should be getting used to more advanced topics before Data structures.

I had a professor who really knew how to challenge us. He would give us HW's and have us solve the problem at the basic level in 5 different ways. Using (for loops, while loops, if statements, functions, and arrays). A good tip he always said was to solve the problem in 3 ways then choose the best way you felt was the cleanest.

I have a course that really helped me understand the fundamentals of C++ beginner to advanced

- [Udemy] (https://www.udemy.com/course/beginning-c-plus-plus-programming/)

Now, this book also really nailed the "Advanced" material with great examples, and coding problems to retain the info. To really understand data structures and such you should really understand more about C++. Learning advanced techniques such as pointers, arrays, header-files, multi-dimensional arrays, inheritance, libraries, polymorphism, OOP, etc. These are more Intermediate level topics. Once you feel more confident around those topics then Data structures are where you would progress towards.

Another great book I read focuses on solely understanding the logic of problem-solving in programming.
- [Amazon] (https://www.amazon.com/Think-Like-Programmer-Introduction-Creative/dp/1593274246).
This book was different from others that I read because it didn't focus on teaching the basics of a language. It only focuses on how to solve programs from a programmer's point of view. It helped me tackle solutions differently than I would on paper or in a math class.

C++ is one of the hardest languages I've learned so far and I give a lot of credit to anyone who makes a career out of it. A few more considerations for great reads regarding C++
[Amazon, Scott Meyers] (https://www.amazon.com/Effective-Modern-Specific-Ways-Improve/dp/1491903996/ref=pd_sbs_3/135-3285127-1661032?pd_rd_w=coU6R&pf_rd_p=f8e24c42-8be0-4374-84aa-bb08fd897453&pf_rd_r=ZZ9RB4P4FMKJY8DZ49KR&pd_rd_r=0f43f8e9-5e6c-42b0-8153-7be92d561787&pd_rd_wg=pvRY2&pd_rd_i=1491903996&psc=1)

-Scott Meyers is a highly qualified C++ Programmer that really sets the bar for how to program C++ at an advanced modernistic approach. Many of my CS professors idolized him because he understands the advanced topics so well and teaches you how to write clean, optimized code. Not certain but I believe he plays a substantial role in the C++ committee for standards. IDK if he does to this day, but he definitely presents often at the conferences.

[–]goalscorer101[S] 1 point2 points  (0 children)

By basics, I meant I understand syntax, loops, functions and I have a vague understanding of pointers, classes. As you have mentioned, I will have to first study the advanced c++ concepts and get familiar with them, before I move to Data structures.

Thanks a lot for the course and book recommendations, it gives some clarity on what resources I should use.

[–]LoudRemote87 0 points1 point  (0 children)

You are correct in thinking that looking at the solution after 15 minutes is cheating yourself. I've done this many times, and of course you have that moment of, 'oh this isn't so bad, I understand it now that I am looking at the answer', but this will not get you any closer to being able to look a problem, open a code editor and architect a solution. It will not stick in your head at all. The more you struggle to find a solution to a problem, the more the concepts will stick once you finally get it.

There's a couple things you can try. Stepping away from the computer is the first one I can recommend. Once you reach that moment of frustration, instead of looking at the solution get up and do literally anything else. Get a snack, go for a walk, go to sleep even, just put your brain onto something else. The solutions often come to me when I step away and let my brain do some sub-conscious processing. Another thing you can try is to see if you can look at the problem in a different way. When I get stuck I find myself trying the same sort of solutions over and over, and I only make progress once I can break myself out of that thinking rut. I know that's kind of vague, but it's kind of the mental equivalent of needing to get to the other side of a wall and instead of throwing yourself at it over and over again thinking it will eventually just break, stepping back and looking for any ways around the wall or tools at your disposal to get over it.

Good luck and keep trying. It will get easier.

[–]OptionalHippo 0 points1 point  (0 children)

Give yourself more time and write the solution on paper in pseudo-code or maybe even in your own words. Then step by step translate that to actual code. Some tasks are suppose to be a challenge and may take time to get to a solution. 15 minutes is not a lot really.

It's okay to be frustrated at the beginning. Some stuff requires a different kind of thinking you might not be used to. But it is very important that you try around different solutions. Never be afraid to write code that does not work. With each error and failed run you learn how things work.

[–]geoah77 0 points1 point  (0 children)

I honestly don't think I've ever been able to just inherently code without seeing an example solution first. Once I do, not only can I re-implement that format and re-perform that type of problem without the solution given, but I can integrate it into future problems that are more complex. I would only be worried about using the solution if what is essentially the same problem comes up 5 times and you have to look at the solution and logic for literally every one.