Lecture 7 | Programming Abstractions (Stanford)
Top Comments
All Comments (12)
-
I think you give wrong idea about recursion. You shouldn't put it in your toolbox as something to use all the time to solve all these great problems. It should generally be avoided. All problems can be solved without it, and most should. It makes ugly hard to find bugs, and code that doesn't make sense at first glance. Not to mention even modern compilers can't optimize it very well. So that leaves "elegant" (hard to understand) code that runs slow.
-
You should not explain recursion as a mysterious indespensible tool that lets you solve infinite problems that were previously unsolvable. Its a loop with a stack. Which is surprising you don't just point this out, because you just taught what a stack is! I don't understand why schools start with high level languages and go down, much easier starting low and learning high.
-
Agree, two thumbs up.
-
!!This student with the mc who is always coughing is very annoying
-
At about 22:00 there is a nice example developped on how finding with a dictionary all anagrams of different words quickly, using map and set.
Of course Map and Set are from the course library not the STL. but the code is quite simple and is done step by step (with some classic errors like passing by reference) and fairly mutable to use the Standard Template Library.
-
listen carefully at 9:54 lol she sais F'n A lol
-
That example for campus survey is more like a map-reduce than a recurssion... I think..



Yes, that is what was happening in the constructor for Set.
Set(int (cmpfn)(ElemType, ElemType) = OperatorCmp);
OperatorCmp is the template function that just uses the built in operators.
tokinonagare27 3 years ago 6
Does any one know if you can assign a default callback function in the function declaration?
i.e.
void function(int a, int (fn)(int,int) = &sum)
bluehavana1 3 years ago 2