Live data from Hacker News

Algorithms

khanacademy.org

151–160 of 163 posts

Re: Algorithms

#151

Earlier quoted context omitted.

Amusingly, significant whitespace is the one reason I don't like using Python in whiteboard interviews - my handwriting is far from excellent on a board, and I don't want any ambiguity when reading my control flow. I'll definitely second the list comprehension point, though. Between that and pleasant string support, a lot of standard interview answers are maybe 50% as long in python as Java. Not easier, necessarily,…

Indentation is a pretty good thing to practice for whiteboards. A lot of people have a tendency to waste more and more space on the left as they go. It's a pretty easy thing to fix, just do some questions and have someone there to correct you whenever you start doing it. Even if you aren't using python, it will give you more room to work (the other part of this is divide the board before you start).

Yeah, I definitely suffer from that rightward drift, which I suppose I should work on. Somehow I never thought to divide the board, that's an easy improvement!

Re: Algorithms

#152

Earlier quoted context omitted.

This is just my opinion and I'm sure it differs from others... Roughgarden's class is advance and expects mathematical maturity. You may find his course quite fast and rough if you are a beginner. Sedgwick's class is much easier. He is a bit boring and tries to use "real life" examples (in some instances) from the physical sciences to make the material relatable. This in my opinion detracts from the material. Also, h…

Great post, thanks for the resources. I find there are a lot of online resources for those looking to learn algorithms and data structures but I've had trouble finding the same breadth and depth of resources surrounding the math behind CS (discrete math, probability, etc.). Any suggestions?

Read "Discrete Mathematics" by Epp. Probably the easiest Discrete Math intro I came across.

Re: Algorithms

#153

This is an excellent course and helped me get my current job. My background is chemistry/chemical engineering. I had applied for a data scientist position. Phone interview included a problem where I was asked about my solution's complexity. I admitted I didn't know about it. Still got called back for an interview on site, but the weekend before I powered through this course. Unsurprisingly, it came up in the on-site…

Python is the algorithm king as far as I'm concerned. It really gets out of your way and lets you focus on the abstract nature of what you're trying to accomplish.

Python is a fantastic language for learning algorithms. It's also a good interface for higher performance, lower level systems language libraries. That said, it is certainly worth the effort to learn one of those systems level languages to pair with python.

I always say that python is like the English of programming languages; it's an amalgamation of other languages, programming paradigms and a rich set of libraries, and often serves as a 'Common Tongue' to glue disparate processes together. There is an inherit risk to that, though. Because it's so easy to transition between object/procedural/functional modes, because it's so easy to tie together so many different interfaces, because it's so easy to `import everything`... it is often too easy to avoid a proper separation of concerns. The flexibility comes with a disincentive towards discipline.

All of the pedantry of systems level language performance and practices aside, even the context switch alone between 'algorithm language' and 'application language' is beneficial to promoting better discipline in both areas.

Re: Algorithms

#154
post #103

The Coursera Stanford [0] and Princeton [1] courses start again soon, February 20 to be exact. Not sure which one is better, but to refresh my atrophied CS skills of 10 years I've joined the Stanford course. Not sure how it compares to the Khan Algorithms course. Anyone have any feedback? [0] https://www.coursera.org/learn/algorithm-design-analysis/ [1] https://www.coursera.org/learn/algorithms-part1/

This is just my opinion and I'm sure it differs from others... Roughgarden's class is advance and expects mathematical maturity. You may find his course quite fast and rough if you are a beginner. Sedgwick's class is much easier. He is a bit boring and tries to use "real life" examples (in some instances) from the physical sciences to make the material relatable. This in my opinion detracts from the material. Also, h…

> Order of easiness is probably Khan Academy > Algorithms Unlocked > MIT Algorithms Course > CLRS.

Where does Roughgarden's course fit in to this?

Re: Algorithms

#155

Earlier quoted context omitted.

It's just caching. Recursion not required, iterative DP solutions are things too.

Dynamic programming is not caching. Memoization is caching, the use of which is not required in dynamic programming.

It's literally the two things which are mentioned on the opening phrase on wikipedia: recursion and caching.

Maybe you could explain better...?

Re: Algorithms

#156
I have to applaud the attempt.

And I'm kind of smirking right now, because again asymptotic got butchered.

I've spent the good part of this semester trying to get my head around a very formal, very dense script of my own algorithms course. And I finally cracked asymptotic. Maybe I'm just dense. But If that's the case, I'm sharing a classroom with others who are equally dense.

We dealt with all 5 classes, big oh, small oh, theta, big omega and little omega. We're required to always give the "most exact" classification for best/avg/worst. Including "does not get as fast as" or "does not get as slow as"

I'm willing to write a "freshman friendly" write up if someone's willing to post it or use it. I'm shit at self publishing.

Re: Algorithms

#157

Earlier quoted context omitted.

Dynamic programming is not caching. Memoization is caching, the use of which is not required in dynamic programming.

It's literally the two things which are mentioned on the opening phrase on wikipedia: recursion and caching. Maybe you could explain better...?

The Wikipedia article is incorrect. The caching, or memoization, is a technique heavily utilized in dynamic programming. Page 183 of Algorithms [0] has an explanation of what memoization is and how it is used in dynamic programming. This StackOverflow answer [1] also has a good explanation of the differences between DP and memoization. Any decent algorithms textbook will also have a section dedicated to DP.

[0] https://people.eecs.berkeley.edu/~vazirani/algorithms/chap6....

[1] http://stackoverflow.com/a/6185005

Re: Algorithms

#158

Earlier quoted context omitted.

If the 'javascript hacker' doesn't learn about the difference between iterating through a list and binary searching, and how/when one is better than the other, yes it is a problem. I say this as a self taught programmer who studied a non-CS engineering well after learning about big-O.

Can you give me an example of when a front end developer would need to do either of those things? On the back end sure, but on the front end? Who in the world is using JS to iterate through a list or do binary searching on the front end?

Maybe for front end a better example would be the difference between a list and a hash map.

And the front end is used for some pretty crazy things these days, eg 3D rendering. Sure if you're making a social network for cats it probably isn't an issue, but then not everyone is.

Re: Algorithms

#159
post #107

Earlier quoted context omitted.

The information made intuitive sense to me. I just couldn't apply what was read directly to the exercises. It felt as though something crucial had been omitted. That something turns out to be calculus.

You don't technically need calculus, but knowing about limits does help.

I appreciate the insight. For w/e reason this has been one of the more difficult concepts to grasp.

Re: Algorithms

#160
post #36

Earlier quoted context omitted.

If Python is the king, C is the court jester juggling knives. Done well it looks amazing, elegant, and efficient, but in the wrong hands you'll lose your hands.

There's a great book title that plays off this idea: "Enough Rope to Shoot Yourself in the Foot: Rules for C and C++ Programming" [0] It's also perhaps the best mixed metaphor I've ever encountered. [0]: https://www.amazon.com/Enough-Rope-Shoot-Yourself-Foot/dp/00...

I said this by accident in a meeting one time and everyone got a good laugh from it. Must have got it from this book unconsciously.
Post reply on HN