Introduction to Algorithms Book

Hi all,
So as I’ve posted in a previous post. I have been having trouble with the Basic Algorithms section of the Javascript module here on Free Code Camp. I have reviewed it roughly four times over the last couple of weeks and some of it is sticking! Hooray, and all that. That said, part of it I know is sheer memorization of the specific solutions . Don’t get me wrong, I am also breaking it down into plain English, conferring with Mozilla Web Docs and really trying my best to understand this.

I love my books, and in fact prior to Free Code Camp, my major primers were Head First Javascript and A Smarter Way to Learn Javascript. I’m currently going over Javascript the Definitive Guide, which is like all the Mozilla Docs in a book (or so it seems anyway). I also plan on moving onto Javascript, The Good Parts and also Eloquent Javascript after that.

I also recently purchased Introduction to Algorithms by Thomas H. Cormen. It’s an MIT intro textbook, which has quite a bit of corresponding lessons on Youtube which may prove helpful. The thing is, I’m not sure if I should I take a break from my other Javascript books in order to better understand the mathematics behind algorithms. What order should I be learning this in? I’m loving Free Code Camp, and also wanted to give other free resources like the Odin Project a try after I get done with some of the other modules here, specifically the D3, React, and Node modules. But then there’s just wrapping my mind around algorithms… ack, sorry I know this was a long post, but I’m kind of torn which deserves more of my attention. Any advice would be appreciated.

1 Like

I don’t agree with this.

Or let me ask you this:
How many complex things in life can you solve because you rote memorized the specific solution? Probably not that many, because you can infer the solution because you understand the concepts. And even if you use some memorized solutions, you are able to use alternative solutions because you understand the concepts.

I recommend to continue your web stuff and add some sort of algorithm games, e.g. codewars or project euler for like 30min per day.

5 Likes

Hi @tomit4 !

Like anything, getting comfortable solving algorithms just takes practice.

I second @miku86 's suggestion for codewars.

Make sure to start with the 8kyu problems because that is for beginners and then you can work your way up from there.

And the great thing is, the solutions are not revealed until you solve the problem :grinning:

Just keep practicing and take it day by day.

1 Like

I understand what you mean, but I can’t even pseudo code some of these algorithm problems, like I don’t know when to declare a variable or start a function or start a for loop. Whenever I go to codewars, I have no idea when to start, plus there are some node.js terminology I’m not familiar with in order to navigate the problems. At some point I have to look at the answers in order to know even what the logic is or where to start.

Other times on FCC I’m noticing that certain concepts haven’t been introduced, so I check the answer. The answer introduces a new method that hasn’t been presented before in the program. No problem, look at the Mozilla documents. Only on Mozilla documents they don’t give enough examples or extremely simple problems to solve to allow for the concepts to sink in. I feel like I need a textbook of extremely simple problems to solve right after the concept has been introduced. and then there should probably be a chaining of similar methods presented thereafter… I see why people go to more organized and structured bootcamps since teaching yourself requires you to navigate through a sheer monsoon of terminology and information, and I am determined, but something tells me I’m going to have to memorize until the concepts and logic become apparent over time.

My plan is not to memorize everything, that would be impossible, but rather to memorize the order of operations, so that I can eventually understand the logic by a kind of absorption. Hopefully this works, my logic skills have always been very bad even in everyday life situations.

That is the tricky part about doing algorithms for the first time.
A Lot of times you are going to stare at a blank screen and not know where to start.

Or you will try to write some code but then it ends up being completely wrong and you have to start over.

That is part of the learning process.

My advice is to come up with a plan and slowly code it out.
You might be wrong a lot of the times and that is ok.
But it is all part of the process.

You are right in saying that some of the solutions do use concepts that weren’t introduced in the curriculum.

The algorithm sections will force you to research new methods.
I understand your frustration but you will end up learning some cool new methods.

You could try these katas to get started.

You could also try the w3 resources for extra practice

There has already been a lot of good advice given, especially about doing a little every day. Small steps take you far over time.

One thing I often do when solving an algorithm that I don’t already know is that I try to imagine how I would solve it without the computer. For example, when trying to solve a sort algorithm, I might take some cards and see how I would sort them. Using something concrete like cards oftentimes can help you understand the issues. Many times I have to push away from the computer and grab some paper to sketch out the ideas. Once I get clear on them, then I work on figuring out the code.

That being said, studying a good algorithm book (or website) can help your understanding grow. It’s not the memorization, but the understanding that makes the difference. If memorizing leads to your understanding, then memorize. Everyone has their own learning style.

2 Likes

It sounds a little like your trying to the memorizing the code solution and hoping to eventually “absorb” the logic.

This might be backwards.

When presented with problem, you usually follow the following rough steps:

  1. Determine what the actual problem is
  2. Determine a plan of how to solve that problem
  3. Implement your plan on how to solve it
  4. Test it to see how it works
  5. Review and repeat if necessary

So if your focusing on memorizing the solution you actually are more jumping to #3. If you don’t focus on #1 and #2 you will have a tough time executing these steps, all of which are necessary to solving a problem on your own later. Its true that almost all problems you may face have been solved before, but that doesn’t mean you can’t solve them on your own given some time.

Its true that you have to remember some things, but I don’t suggest to focusing on memorizing specifics. Rather you memorize them thru using them. Knowing when to use something is more important than memorizing something to use (if that makes sense), as you can always look up the specifics.

FCC’s approach usually is to present you a “similar” example, or assume you leverage your previous experience. This doesn’t mean it gives you the answer, but rather it usually gives you some kind of “hint” in its example. Its more a question if you can figure out what FCC is trying to teach you, rather than what FCC expects from you. With this approach, if you guess/assume what FCC is trying to teach you, you should be able to figure it out even if your just kind of making educational guesses against the test cases.

With this flow you go back to the 1-5 I posted above. Your given a problem, are required to understand what its asking, formulate a potential answer, try it against the tests, and review what happens. Furthermore, as you keep testing you probably wont get it right the first time, thats OK!. Thats where the review/learning part comes in and you repeat the entire process on the problem. You usually have to break down the problem into chunks as well, this can only be done if you understand the different parts of the problem itself, rather than looking at it as a whole. Once a problem is broken down finding and getting help is easier. Without breaking it down your essentially “looking at the solution” by itself, rather than part of the problem you need help with.

Hopefully that helps! Goodluck keep learning, keep building!

4 Likes

These resources are helpful. Although especially with codewars, it’s a challenge. I will continue to go back to them as I have heard from many sources (reddit, etc.) that codewars is a good place to understand coding regardless of your skill level. The ofrmat of the w3resource page is a little lacking in an intuitive UI, but I’ll investigate it. You’re super helpful, thank you!

Yes, I have made attempts at writing pseudo code, and it has helped some of the concepts stick. Sorry if my post sometimes feels like a rant, honestly I’m just frustrated that my usual techniques for retaining information (i.e. memorize until the “oh I’ve seen this before” kicks in) isn’t really working. I forget things very very easily, and have only been able to retain information if it is repeated to me a lot… like a lot a lot. Plus coding requires me to think logically. Logic has not been required for most of my everyday life as my career has been filled with a lot of menial labor and repetitive task jobs. I simply do a lot of the same things every day, and if a new problem is presented, I usually am unable to figure out how to solve it without a lot of hand holding. This has caused a lot of issues with learning new skills and I guess I need a lot of hand holding for something to stick. I’d go to a bootcamp, but honestly don’t have the resources to do so, so here I am, trying my best to figure it out. Thank God there are a lot of good resources online for this. Otherwise I’d be completely lost.

1 Like

Mmm, this is a good reply as well. I think that trying to wrap my head around ‘what is FCC trying to teach me,’ is going to be most difficult as I don’t really understand the actual utilitarian application of a lot of this information. I don’t really have any projects in mind that I’d like to do after acquiring the skillsets, nor any job that I’m particularly interested in acquiring with these skills… I just want the skillset for it’s own sake…which I think might be hindering me as I try to navigate going about this. Nevertheless I’ll continue to do my research in my own way, while at the same time taking into account what everybody has said here.

You’ve all definitely given me some great insights into how to go about learning and how to think about coding when it comes specifically to solving algorithm problems, and I greatly appreciate the time you’ve taken to help elucidate on the problem solving process. Thank you so very very much!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.