• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Grokking Algorithms: Recommended prerequisite knowledge?

 
Ranch Hand
Posts: 386
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aditya,

I've been trying to improve my knowledge of algorithms, having been stumped on the 'largest sub-sequence' problem on a website called codewars. I started going through Richard Buckland's great lectures on data structures and algorithms, but felt I lacked a bit of underlying knowledge to get to the end.

So I then started studying A-Level Decision Maths (UK high school qualification), but found that it mainly teaches how to follow, rather than create and understand algorithms, conversely seeming rather easy.

Anyway, I guess my question is: To what degree are algorithms learnt parrot fashion? Am I being too hard on myself for expecting to naturally understand them quickly? Or is it just a case of repeatedly seeing, and therefore being able to identify and replicate a given pattern.

Apologies for the long question, and welcome to coderanch!

Nick
 
Author
Posts: 13
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Nick,
Good question! I cover longest common subsequence in the chapter on dynamic programming.

It sounds like we are on the same page: I think algorithms are a tool that you learn to use, not a chunk of code to memorize. Grokking Algorithms focuses on practical knowledge.

I also focus on breaking concepts down into small steps. You might be interested in this post of mine from a while back, comparing my approach to existing approaches:
https://gist.github.com/egonSchiele/c1ca3e08749169463d37

However, dynamic programming is tough. It is the toughest chapter in my book, and I've met a lot of professionals who still don't understand it. So don't expect to get it right away
I made a "FAQ" section for the dynamic programming chapter for common stumbling points, that might help you.
 
nick woodward
Ranch Hand
Posts: 386
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply!

I like the practical approach, breaking things down into chunks, and it's good to know that not being able to 'see' the solution to the longest subsequence is not necessarily a failing on my part!

However I still feel like my understanding of where to start is a little circular. When first starting out do you learn the 'tools' just by copying and using them (which in itself feels a little like memorisation) and then apply them to different but similar scenarios? Or should you be able to work them out from an underlying logic or mathematical base already acquired elsewhere? I suppose this is just another 'assumed knowledge' question - but I find that I've had to back away slowly from many of the big name algorithm books that claim no prior knowledge :-D

Thanks again, will definitely check out your book in the coming weeks!

Nick
 
Aditya Bhargava
Author
Posts: 13
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Nick,
Copying and using code is a good place to start. In my experience, I've learned more by getting a chunk of code and playing with it, than I have by trying to read through long proofs, or understand the mathematical base of the solution. I don't know if you have seen Rosetta Code: https://rosettacode.org/wiki/Longest_common_subsequence

It has the code in many different programming languages. That could be a good place for you to start.

When you want to understand how the algorithm works, that's where Grokking Algorithms shines. I focus on practical examples, and I walk through the code line-by-line. I think this is more useful than proofs. Does that help?
 
Aditya Bhargava
Author
Posts: 13
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nick,
I should've mentioned that chapters 1, 2, and 6 are available for free on Manning's website: manning.com/bhargava.
You could read one of those chapters and see how it compares to a more traditional algorithms book.
 
nick woodward
Ranch Hand
Posts: 386
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it does indeed! thanks!

that rosetta code website looks great too. that's my afternoon/evening sorted!

thanks for the replys, much appreciated

nick
 
no wonder he is so sad, he hasn't seen this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic