-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathMidTermLessons.html
146 lines (143 loc) · 4.47 KB
/
MidTermLessons.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css"/>
<title>
Mid-Term Lessons
</title>
</head>
<body>
<h1>
Mid-Term Lessons
</h1>
<p>
<ul>
<li>Knuth quote
<br>
Code that works but that is incomprehensible is <em>bad
code</em>.
<li>Back-of-the-envelope calculations
<br>
The pigeon hole principle
<br>
n<sup>2</sup>
<br>
1 - (1/n) lg n
<br>
(n + 1) / n
<li>Iterators
<br>
OTA option feeds.
<li>Loop and algorithm termination
<br>
Can't put value where pointer should be!
<br>
Ex:
<br>
while current->next != NULL:
<br>
current = current->next
<br>
current->next = value
<br>
<br>
Even if you code it right, it's too complicated.
<li>"Minor" bugs in the real world
<br>
Just set timeout to 0!
<li>Short-circuit or?
<li>What to return?
<br>
Don't just print!
<br>
Library code can be running anywhere. Set-top box. Car engine.
Phone. Satellite.
<br>
<br>
"Siri, I'd like the number for Ashwin Ravishankar."
<br>
Returning the key of a dictionary search.
<br>
Returning True if the key is there.
<li>Direct addressing "function"
<li>Recognize problem in new context
<li>Indicator variables
<li>Deleting from linked lists
<br>
Singly versus doubley linked code.
<li>Can't assign number to a function!
<br>
h(x) = h1(x) + h2(x)
<li>Exponential growth:
<br>
<br>
<table>
<tr>
<th>
n
</th>
<th>
n<sup>2</sup>
</th>
<th>
1.1<sup>n</sup>
</th>
</tr>
<tr>
<td>
10
</td>
<td>
100
</td>
<td>
2.59
</td>
</tr>
<tr>
<td>
50
</td>
<td>
2500
</td>
<td>
117.39
</td>
</tr>
<tr>
<td>
100
</td>
<td>
10,000
</td>
<td>
13,780.6
</td>
</tr>
<tr>
<td>
200
</td>
<td>
40,000
</td>
<td>
189,905,276
</td>
</tr>
</table>
</ul>
</p>
</body>
<!-- google_analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-97026578-2', 'auto');
ga('send', 'pageview');
</script>
<!-- end google_analytics -->
</html>