Struggling with intermediate algorithm scripting, advice welcomed

Struggling with intermediate algorithm scripting, advice welcomed
0

#1

Hi guys.

I started on FCC just under 2 weeks ago.

I’ve completed the intermediate front-end projects and I’m trying to work my way through the next set of algorithms.

Problem is that I feel as though I am hitting my head against a brick wall.

I bungled my way through the Roman Numeral Converter (my code is ugly and required me hardcoding a lot of values), I had to check the solution for Diff Two Arrays and I’m now fighting against Wherefore Art Thou (and not expecting I will win this battle).

More frustrating is that I am sure I could code these problems in Python without much issue, but I can’t think how it would translate to Javascript.

I write out some psuedo code before I start, but that goes out of the window so quickly.

Does anybody have any external resources that might help me through this part of the course? Or inspiring words of how you overcame a difficult patch on the course?

I don’t want to google the answers, but without doing so, I think I will end up booting my computer through the fucking wall.


#2

Disclaimer: I don’t know the 1st thing about python. Is the algorithm really different from one language to another? I would have thought “no”.

I am also working (struggling) through the intermediate algos. I don’t think they’re supposed to be easy! They’re designed to teach you to develop a step-wise solution to some stated goal(s) - aka, an algorithm!

You’ve progressed very quickly (all the way into intermediate algos in 2 weeks) - are you struggling with the language itself? Or identifying / developing the required algorithm?


#3

They’re supposed to be challenging! What value would Free Code Camp have if everything were easily doable? Learn to trust yourself to take on the big challenges, because this is what building software is like. If you can write out the algorithms in Python, then write them in Python first and translate them to JavaScript.

Frustration is a sign that you’re learning. There’s no book or resource that’s going to help you. Just do it!


#4

there is a repeating pattern => you can write a function and call it several times

divide the integer number by 1000s, apply the Roman numbering logic (for 1 to 10 integers), and proceed with the remainder, divide by 100s, apply the Roman numbering, … and so forth


#5

I observed for myself that I applied a lot

  • C-ish style programming (i.e. using for-loops, access array elements, and functions), and
  • map-reduce (filter, reduce, etc) where array/vectorized thinking might be helpful (e.g. filter numpy array with a boolean index array)

for loops and map reduce.


#6

No. Of course the algorithm is the same.

I think it’s just because I have so much more experience with python, that I think it out in a pythonic way. Javascript just has different ways of doing things, and so I stumble when I try something that works in python but I don’t know how to implement the equivalent in JS.

I gave it a rest after writing this post, and moved forward and completed the next 5 with no issues.

I think I was a bit tired and dehydrated and my brain wasn’t functioning so well because of it.


#7

Hey, thanks for the reply.

I gave it a rest for a while. I accepted that the hard part is knowing how to implement it, and that if I know I can do it in Python, then the difficult part is done.


#8

Check out the solutions offered by CamperBot when you’re done with a challenge. If you search for the forums for "algorithm " + challenge name, there’s usually a post from the Camper Bot that has a nice breakdown of the problem, and offers usually 2-3 options to solve it of varying difficulties. After I complete one of these challenges, I look it up and compare.
Also, the Camperbot’s post is structured really nice so if you’re having trouble with the assignment, you can look at the thread and read some of the clues/hints before seeing the code, so it won’t be spoiled for you. :slight_smile:
You just started FCC two weeks ago… no sense barreling through all this stuff if you’re running into snags… take the time to look at the various solutions and see what was done differently. Good luck!