|
|
|
|
|
by nikhila01
1364 days ago
|
|
You should read about dynamic arrays more carefully. They have amortized O(1) insertion which is better than a tree, and the data is contiguous in memory which gives it better cache locality than a tree. They are one of the most popular data structures. Parts of your post also seem to me to be quite boastful and low-value: (paraphrasing) "the course takes itself very seriously", "why spend so much time teaching so little material", "these topics are mostly old; just read Knuth", and "dynamic programming is easy; I learned it in 90 seconds and then did my PhD in it". |
|
The course pressed hard on the students to devote, what was it, 4 hours of time a week in group sessions with more hours in independent study. That's asking a lot from the students.
In response I had a lesson and purpose in that post: (A) That collection of fundamental algorithms hasn't changed very fast, were much the same 40 years ago. (B) Nearly all the algorithms are quite simple and each one can be learned quickly, including the derivation of its big-O performance, and coded, running, and tested in 2 hours or so. (C) I mentioned Knuth v.3 as a reference: Tough to improve on that Knuth volume as a reference for such algorithms. (D) For hashing, network flows (graph search), and dynamic programming I gave really good references -- tough to compete with any of them. I used some of my experience to illustrate (A) -- (D).
That lesson should be some quite good news for any HN readers considering studying the algorithms.
> Parts of your post also seem to me to be quite boastful and low-value:
No, I just used some of my experience to give examples of my points.
> You should read about dynamic arrays more carefully. They have amortized O(1) insertion ....
I saw all that. Get the O(1) property only with some assumptions and some math derivations, and I mentioned the math.
Two obvious problems:
(1) It is trivial for any of us to think of applications where the new allocations and copying would be wildly wasteful.
(2) For the assumptions, we will rarely have enough information to have much confidence in our math derivation.
We also can think of
(3) The reallocations, when there are a lot of them, will create problems for the memory management, garbage collection.
Sure, any of us can think of niche situations where (a) we do a few reallocations and (b) then go for hours, ..., months with no more reallocations and with the advantages of arrays.
Dynamic arrays don't belong on a list of Best Algorithms.
Again, my guess is that the interest of the course in dynamic arrays is an opportunity to do the math derivations.
The people that MIT course is intended for are maybe good HN readers, so an issue for HN readers is, should they devote a lot of time to that course? We review movies, restaurants, etc., and we might also review courses.
Your attack on my review was mostly an attack on me: You resented my post because I mentioned some of my background and in response attacked me. Instead, make a good contribution of your own, maybe as a review of that MIT course.
I'll state the basic lesson again:
The algorithms in that course are nearly all quite good but old, with some really good old references, and can be learned quickly, say, the whole course in a few weekends.