Algorithms, related to skill level

Algorithms, related to skill level
0.0 0

#1

I was curious. Is a person’s ability to solve coding algorithms deeply related to a persons skill level and understanding of the language? I was going through some of the algorithms, and although i would have the idea of how the pseudo code would go–due to the lack of my skill in JS i wasn’t really able to convey those thoughts in clear code to come to a viable and passable conclusion. Also, when you are unable to answer an algorithm, what is the best practice? Should you try to continue thinking it through? Should you look for the methods that you think would help you solve the problem? Should you use the peak function? Sorry I just want to ensure that I’m learning this as it’s intended, and which will be most beneficial to me in the future.


#2

Well, you’re likely to end up with progressively better/more efficient/more elegant solutions the more you know of the language, but they’re not necessarily related to advanced technical knowledge re the language (JS in this case).

They are, though, a way for you to exercise and build up your knowledge of programming techniques via very small, isolated challenges. First time out, maybe you get completely stuck, so you look up how someone else has done it - that’s going to be totally fine as long as understand how that solution works; you’re going to absorb that knowledge so you can use it next time you encounter something similar. Then later on, maybe you learn something new about the language - you can go back and refactor the original solution using that knowledge. Or you finally understand some mathematical method (like say Sieve of Erastothenes for finding primes), so you figure out how to write that in code and refactor your solution. Maybe you realise that is inefficient - second time you did it, that wasn’t an issue, you just wanted to get it finished, but now you can redo it, modify the code so it works better.

Use them as a jumping-off point for learning techniques/methods/general programming ideas/language-specific features.

Always try to break the problem down into the smallest, simplest constituent parts - this is what I mean by not necessarily needing advanced technical knowledge, it’s more about understanding what the problem is and how to turn that into a collection of tiny, easily-solved problems, then composing those solutions back together.

Yes, look for methods that you think would help, use MDN constantly, learn to read the documentation.

One thing I’ve found always found invaluable when learning these things is http://www.rosettacode.org/wiki/Rosetta_Code, which is a huge collection of solutions to small programming tasks in different languages. If you use it, don’t just look at JS solutions - Python solutions, for example, translate pretty well across to JS - it’ll be gibberish at first but you’ll pretty quickly be able to start to see things that map across language boundaries.

Wikipedia is generally very good on logic/mathematical algorithms, and quite often has pseudocode (or often Python) examples. I’m prettyy awful at maths, so my technique has normally been look up stuff on Wikipedia, then start googling for other people’s programmed solutions - Stack Overflow is great in this regard.

As an example, when I’m learning a new language or trying to get back into an existing one, I try to go through the problems on http://exercism.io/, which is a set of problems like the FCC ones, I’ve redone some of them tens of times, just gone back and forth looking for better solutions.


#3

Thanks so much for these resources and your input on this. It’s something that kind of annoys me because a lot of things come to me quite well, however I just want to make sure that it’s supposed to be as challenging as it is lol. I really appreciate your help Dan


#4

I found it was not my level of coding but being able to break down the problem into sudo code and understanding what needed to be done. once i broke it down and understood the problem i wrote the code. There were parts that i wasnt sure how i was going to code or code effectively with what I knew so i would google methods to see if i could find something suitable to use … eg when i was doing symmetric difference i wanted to remove duplicates eg [a,a,b] … i then discovered javascript sets
Looking through and uderstanding string, array, and object methods will give you a lot of the tools required for these algorithms eg filter, reduce … you can do an awful lot with the methods for string,arrays and objects
I finished all the algorithms using all of the above … nothing fancy … and while most of them I am happy with a few are a bit drawn out. after I finished i would look at solutions to compare mine against … and would feel a bit envious of how the solutions shown are done … but mine work, I learnt a lot while doing them and I can work towards improving them.
So keep the code simple even if it is a bit longer than the solution shown… you can always look back later and see can you improve on them … I do this now and again when i need a change … in fact at the moment im converting them to python to learn how to use python lol


#5

So in a certain sense, algorithms also help you realize that you’re not going to know everything, but promote research as a method to solve the problem. Thank you, I’ll apply this approach to algorithms I’ll learn from that!