I am really bad at algorithms

I am really bad at algorithms
0.0 0

#1

Hello all,

I had some trouble with the basic algorithms and wound up just looking at the solutions because I didn’t even know where to begin. It makes me feel really stupid or like I am cheating. I scroll through all of these people’s solutions and wonder how their brain thought that up.

Then I get to these intermediate algorithms and its vastly more difficult. I look at the MDN docs that the challenge links and I either have trouble understanding what the function does or I understand it but I can’t apply it because these challenges want you to combine a bunch of different functions to get to the solution.

What is really bothering me is, I see people saying you don’t need to understand algorithms for a junior position but I can’t even get an interview because the first thing I get is some insanely difficult algorithm test from some outsourced company and I fail horribly.


#2

Algorithms are one part of coding. So, they don’t come easy for you. Maybe some other aspect of working as a coder does - design, debugging, networking, testing, etc.

That being said, algorithms are important. They teach you how to think about solving problems and some of the basic patterns can show up in the real world. And they are often tested on job interviews.

I see people saying you don’t need to understand algorithms for a junior position

Yeah, there is always someone saying something. As a jazz guitar teacher, I often have people come to me and say that their last teacher told them they don’t need to practice scales, which to me is insane. The great Joe Pass once said that he doesn’t think about scales that much. Of course, I know enough about his bio to know that as a child he spent hours a day practicing scales. Like I always say, we practice scales so we don’t have to think about them. I would say the same thing about basic algorithms.

If you have an algorithm on which you are confused (even after passing) ask the group. I guarantee there are a lot of people that are also confused but are too chicken to ask. And look on youtube - often there are people explaining basic algorithms with graphics to help.

Algorithms can be difficult for some people. But I think if you learn a couple of basic ones, it will gradually get easier. But you just gotta do them. For some people, they are a little easier in the beginning. But we all reach a point where we have to work at them.

Like I always say, this job isn’t easy. That’s a good thing. If it were easy everyone could do it and it would pay minimum wage. It’s the people that stick with it, work hard, and don’t give up - they’re the ones that land the great jobs. But everyone struggles with something.


#3

I’m one of the chickens! :chicken:

I was really happy to see this question because I’m in the same boat. I’m having a lot of trouble with algorithms. I was able to do the first two without any issues, and then I got real lost and I don’t even know where to start with the others. When I find solutions, either by checking the hints or accidentally finding the complete solutions via Google, it still doesn’t click for me.

Last night I read an article about thinking like a programmer, so now I’m working on using the article’s lesson of splitting every problem into its sub-problems, solving each sub-problem individually, then trying to fit all the sub-problem solutions together.

Oh man, I didn’t think of that. :pray:


#4

I know that this may be anti-dogmatic, but you may need a CS class. Learning to think like a programmer means learning what they learn. While I haven’t taken it myself, I have heard very good things about Harvard’s free Intro to CS course, which they freemiumized by charging 90 bucks for a certificate (not necessary, really).

I took those classes in undergrad and before, even though I don’t have a CS degree. And it changes the way I look at FCC and learn from it. For example, when I learned about push(), pop(), unshift(), and shift(), I just thought: “Oh cool! Javascript turns all arrays into stacks and queues.” Those are pretty basic data structures in computer science, and knowing about them changes what you know to be possible in terms of problem solving. Doing CS problems will get you where you need to be cognitively to use FCC like a syntax tutor. You might be able to do both concurrently, or do more problems in a more formal course setting (video lectures, questions, answers & explanations of those problems) when you find yourself getting lost. Were I tutoring you, I’d recommend some formal CS learning before going deep into the JS section.


#5

Being able to read a solution and being able to come up with a solution are two different skillsets. You’ve worked on the first. You’ve followed other people’s solutions on increasingly difficult challenges. But think of the problem solving skills as muscles that you have to build up. Now that you’ve gone through the first section of algorithms using the reading approach, I would suggest clearing your answers and trying to go through them again without looking at solutions. If you get stuck, come here and ask specific questions. We’ll do our best to nudge you in the right direction instead of showing you the end result.


#7

I think I understand what you mean that Java objects are dictionaries. But what FCC specifically lacks is the content in the first one or two courses taught: Intro (basics of computing, variables, memory addressing, arrays, compilers, pseudocode. recursion, top-down programming) and Data Structures & Algorithms (stacks, queues, trees, graphs, search). If I were coming in with zero experience, I would stumble at precisely the place that the OP does. I’m not saying one needs to be able to invent map-reduce for scalable network architectures, but knowing when to use shift() vs pop() definitely helps with the curriculum.


#8

For sure they are difficult over time and with more exposure to javascript I have been able to truly read and comprehend and how to approach the problems. Some the things you have already learned may make more sense from different resources also so just keep moving forward and relearning some of the material you have already learned when it come to javascript. Visualizing what is happening helps a lot too, with sites like pythontutor, when your code fails you can get a better idea of what is going wrong and and then work on the solution from that angle. Getting comfortable with Debugging should help you out especially if you can use tools like python tutor


#10

#11

#12

I’ve been in the same boat not that long ago. What helped me a lot is breaking the problem into small chunks and solving them one by one, then figuring out how to connect them into a final solution. I’d also not use google to search for the SOLUTION of the whole algorithm, instead use it to search for ways to overcome small chunks we created.


#13

Maybe you just need to practice and get more comfortable with the syntax of the language. Go make an account on CodeWars and practice. They seemingly have endless algorithms to solve at any given difficulty level. Solve their most basic problems until you start to feel comfortable, then move to the next level of difficulty. If you can’t solve a problem and you’ve exhausted all other resources, then take a peak at other people’s answers and try to understand their solutions. Be warned, you may see some cooky shorthands and methods that you’re not familiar with (though don’t be intimidated by them as their easy to learn and very useful).


#14

People say you don’t need algorithms because there is a good portion of work out there where you don’t need it. But at the same time there’s this:

Algorithms are hard

But they are everywhere when programming

So they are a necessary evil

There’s reading the solution, and understanding the solution. You want accomplish the latter.
There’s usually the following steps when being given a problem.

  1. Break down the question into the core problem.
  2. Understand the core problem
  3. Apply you current knowledge to formulate a solution to part of the core problem
  4. Implement your solution in code

Usually you want to go thru steps 2-4 while breaking down parts of the core problem. Learning to do something usually comes down to learning to do part of what you want to accomplish, and combining it all later. Programming is no different. (it probably is all it is)

The main thing is, the first time you are presented with a complex problem, you will be lost since you have little current knowledge to apply to the problem. Looking at the solution is fine at this point, but understanding it is very important. If you don’t understand part of it, break it down and figure out whats going on. (When your given a solution, you kind of want to do things backwards)

There’s also the fact knowing common algorithms provides solutions to a huge vast of potential problems. So knowing whats out there, and how to implement them basically gives you answers to an infinite number of problems.

I’m one of those that say learning algorithms is important because knowing how to do something is one thing, but knowing how to do it well is pretty important too.

The best thing todo is just go out and learn what’s out there, what its used for, and what sort of problems they solve. From there you can figure out how to implement it in code. If your looking at solutions you skip over the first, and most important step. I promise you no one coded their solution first, they just implemented an existing algorithm.