-
Notifications
You must be signed in to change notification settings - Fork 0
/
dsa_07_annihalators_plus.html
538 lines (502 loc) · 25.9 KB
/
dsa_07_annihalators_plus.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="css/fontawesome-free-6.2.1-web/css/all.css" rel="stylesheet">
<script src="lib/colorbrewer.v1.min.js" charset="utf-8"></script>
<script src="lib/colorStringStandalone.js" charset="utf-8"></script>
<script type="text/javascript" src="lib/jquery-2.2.4.min.js"></script>
<title>Design & Analysis: Algorithms</title>
<meta name="description" content="CS4851/6851 GSU class">
<meta name="author" content="Sergey M Plis">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="plugin/highlight/monokai.css" id="highlight-theme">
<!-- <link rel="stylesheet" href="lib/css/zenburn.css"> -->
<link rel="stylesheet" href="css/custom.css">
<link rel="stylesheet" href="dist/theme/aml.css" id="theme">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.scss';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<!-- In between the <div="reveal"> and the <div class="slides">-->
<!-- <header style="position: absolute; top: 10px; left: 100px; z-index: 500; font-size:100px;background-color: rgba(0,0,0,0); text-align: center !important"></header> -->
<!-- In between the <div="reveal"> and the <div class="slides">-->
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<section>
<p>
<h2>Design & Analysis: Algorithms</h2>
<h1>07: Annihilators <i class="fa-solid fa-explosion"></i> </h1>
<p>
</section>
<section>
<h3>Outline of the lecture</h3>
<ul>
<li class="fragment roll-in"> Examples
<li class="fragment roll-in"> Transformations
<li class="fragment roll-in"> Loop Invariants
</ul>
</section>
<section>
<h2>Relative Ranking</h2>
<row>
<img style="border:0; box-shadow: 0px 0px 0px
rgba(150, 150, 255, 0.8); width:60%;"
class="reveal" src="figures/competition_time.gif" alt="competition">
<img style="border:0; box-shadow: 0px 0px 0px
rgba(150, 150, 255, 0.8); width:18%;"
class="reveal" src="figures/course_score01.png" alt="competition">
</row>
<div style="margin-top: -20px;">
Send me your private nicknames ASAP
</div>
</section>
</section>
<section>
<section>
<h1>Examples</h1>
</section>
<section>
<h2>At Home Exercise <i class="fa-solid fa-house-laptop"></i></h2>
<div style="text-align:left; margin-top:10px; width:100%;font-size:26pt;">
Consider the recurrence $T(n) = 6T (n − 1) − 9T (n − 2)$, $T (0) = 1$,
$T (1) = 6$
</div>
<ul>
<li>Q1: What is the annihilator of this sequence?
<li>Q2: What is the factored version of the annihilator?
<li>Q3: What is the general solution for the recurrence?
<li>Q4: What are the constants in this general solution?
</ul>
<div style="text-align:left; margin-top: 30px; width:100%;font-size:26pt;">
(Note: You can check that your general solution works for $T(2)$)
</div>
</section>
<section>
<h2>Non-homogeneous terms</h2>
<ul>
<li class="fragment roll-in">Consider a recurrence of the form $T (n) = T (n − 1) + T (n −2) + k$ where $k$ is some constant
<li class="fragment roll-in">The terms in the equation involving $T$ (i.e. $T (n − 1)$ and
$T (n − 2)$) are called the <alert>homogeneous</alert> terms
<li class="fragment roll-in">The other terms (i.e. $k$) are called the <alert>non-homogeneous</alert> terms
</ul>
</section>
<section>
<h2>Example</h2>
<ul>
<li class="fragment roll-in">In a <em>height-balanced</em> tree, the height of two subtrees of any
node differ by at most one
<li class="fragment roll-in">Let $T(n)$ be the smallest number of nodes needed to obtain
a height balanced binary tree of height $n$
<li class="fragment roll-in">Q: What is a recurrence for $T(n)$?
<li class="fragment roll-in">A: Divide this into smaller subproblems
<ul>
<li class="fragment roll-in"> To get a height-balanced tree of
height $n$ with the smallest number of nodes, need one subtree of
height $n − 1$, and one of height $n − 2$, plus a root
<li class="fragment roll-in"> Thus $T (n) = T (n − 1) + T (n − 2) + 1$
</ul>
</ul>
</section>
<section>
<h2>Example</h2>
<ul style="margin-top: -40px; ">
<li class="fragment roll-in">Let’s solve this recurrence: $T (n) = T (n − 1) + T (n − 2) + 1$<br>
(Let $T_n = T (n)$, and $T = \langle T_n \rangle$)
<li class="fragment roll-in">We know that $(\bm{L}^2 − \bm{L} − 1)$ annihilates the homogeneous terms
<li class="fragment roll-in">Let’s apply it to the entire equation:
\begin{align}
(\bm{L}^2 − \bm{L} − 1)\langle T_n \rangle & \fragment{4}{= \bm{L}^2 \langle T_n \rangle − \bm{L} \langle T_n \rangle − 1\langle T_n \rangle}\\
&\fragment{5}{= \langle T_{n+2} \rangle − \langle T_{n+1} \rangle − \langle T_n \rangle}\\
&\fragment{6}{= \langle T_{n+2} − T_{n+1} − T_n \rangle}\\
&\fragment{7}{= \langle 1,1,1,\cdots \rangle}\\
\end{align}
</ul>
</section>
<section>
<h2>Example</h2>
<ul>
<li class="fragment roll-in">This is close to what we want but we still need to annihilate
$\langle 1, 1, 1, \cdots \rangle$
<li class="fragment roll-in">It’s easy to see that $\bm{L} − 1$ annihilates $\langle 1, 1, 1, \cdots \rangle$
<li class="fragment roll-in">Thus $(\bm{L}^2 − \bm{L} − 1)(\bm{L} − 1)$ annihilates $T (n) = T (n − 1) + T (n − 2) + 1$
<li class="fragment roll-in">When we factor, we get $(\bm{L}−\phi)(\bm{L}− \hat\phi)(\bm{L}−1)$, where $\phi = \frac{1+\sqrt{5}}{2}$ and $\hat\phi = \frac{1-\sqrt{5}}{2}$.
</ul>
</section>
<section>
<h2>Example: Lookup table</h2>
<ul>
<li class="fragment roll-in">Looking up $(\bm{L}−\phi)(\bm{L}− \hat\phi)(\bm{L}−1)$ in the table
<li class="fragment roll-in">We get $T (n) = c_1\phi^n + c_2\hat\phi^n + c_31^n$
<li class="fragment roll-in">If we plug in the appropriate initial conditions, we can solve
for these three constants
<li class="fragment roll-in">We’ll need to get equations for $T (2)$ in addition to $T (0)$ and $T (1)$
</ul>
</section>
<section>
<h2>General Rule</h2>
<div class="fragment roll-in" style="text-align:left; margin-top:10px; width:100%;font-size:26pt;">
To find the annihilator for recurrences with non-homogeneous terms, do the following:
</div>
<ul style="font-size: 26pt;">
<li class="fragment roll-in">Find the annihilator $a_1$ for the homogeneous part
<li class="fragment roll-in">Find the annihilator $a_2$ for the non-homogeneous part
<li class="fragment roll-in">The annihilator for the whole recurrence is then $a_1a_2$
</ul>
</section>
<section>
<h2>Another example 1</h2>
<ul>
<li class="fragment roll-in">Consider $T (n) = T (n − 1) + T (n − 2) + 2$.
<li class="fragment roll-in">The residue is $\langle 2, 2, 2, \dots \rangle$ and
<li class="fragment roll-in">The annihilator is still $(\bm{L}^2 − \bm{L} − 1)(\bm{L} − 1)$, but the equation for $T (2)$ changes!
</ul>
</section>
<section>
<h2>Another example 2</h2>
<ul>
<li class="fragment roll-in">Consider $T (n) = T (n − 1) + T (n − 2) + 2^n$.
<li class="fragment roll-in">The residue is $\langle 1, 2, 4, 8, \cdots \rangle$ and
<li class="fragment roll-in">The annihilator is now $(\bm{L}^2 − \bm{L} − 1)(\bm{L} − 2)$.
</ul>
</section>
<section>
<h2>Another example 3</h2>
<ul>
<li class="fragment roll-in">Consider $T (n) = T (n − 1) + T (n − 2) + n$.
<li class="fragment roll-in">The residue is $\langle 1, 2, 3, 4, \cdots \rangle$
<li class="fragment roll-in">The annihilator is now $(\bm{L}^2 − \bm{L} − 1)(\bm{L} − 1)^2$.
</ul>
</section>
<section>
<h2>Another example 4</h2>
<ul>
<li class="fragment roll-in">Consider $T (n) = T (n − 1) + T (n − 2) + n^2$.
<li class="fragment roll-in">The residue is $\langle 1, 4, 9, 16, \cdots \rangle$ and
<li class="fragment roll-in">The annihilator is $(\bm{L}^2 − \bm{L} − 1)(\bm{L} − 1)^3$.
</ul>
</section>
<section>
<h2>Another example 5</h2>
<ul>
<li class="fragment roll-in">Consider $T (n) = T (n − 1) + T (n − 2) + n^2 − 2^n$.
<li class="fragment roll-in">The residue is $\langle 1 − 1, 4 − 4, 9 − 8, 16 − 16, \cdots \rangle$
<li class="fragment roll-in">The annihilator is $(\bm{L}^2 − \bm{L} − 1)(\bm{L} − 1)^3(\bm{L} − 2)$.
</ul>
</section>
<section>
<h2>In Class Exercise <img style="border:0; box-shadow: 0px 0px 0px rgba(150, 150, 255, 1);" width="100"
src="figures/dolphin_swim.webp" alt="dolphin">
</h2>
<ul>
<li class="fragment roll-in">Consider $T (n) = 3 T (n − 1) + 3^n$
<li class="fragment roll-in">Q1: What is the homogeneous part, and what annihilates it?
<li class="fragment roll-in">Q2: What is the non-homogeneous part, and what annihilates it?
<li class="fragment roll-in">Q3: What is the annihilator of $T (n)$, and what is the general form of the recurrence?
</ul>
</section>
</section>
<section>
<section data-background="figures/rubiks_cube_bad_try.gif">
<h1 style="text-shadow: 4px 4px 4px #002b36; color: #f1f1f1">Transformations</h1>
</section>
<section data-background="figures/prime_optimus_trans.gif">
</section>
<section>
<h2>Limitations so far</h2>
<ul>
<li class="fragment roll-in">Our method does not work on $T (n) = T (n − 1) + \frac{1}{n}$ or $T (n − 1) + \log n$
<li class="fragment roll-in">The problem is that $\frac{1}{n}$ and $\log n$ do not have annihilators.
<li class="fragment roll-in">Our tool, as it stands, is limited.
<li class="fragment roll-in">Key idea for strengthening it is <em>transformations</em>
</ul>
</section>
<section>
<h2>Transformations Idea</h2>
<ul>
<li class="fragment roll-in">Consider the recurrence giving the run time of mergesort $T (n) = 2T (n/2) + kn$ (for some constant $k$), $T (1) = 1$
<li class="fragment roll-in">How do we solve this?
<li class="fragment roll-in">We have no technique for annihilating terms like $T (n/2)$
<li class="fragment roll-in">However, we can <em>transform</em> the recurrence into one with
which we can work
</ul>
</section>
<section>
<h2>Transformation</h2>
<ul>
<li class="fragment roll-in">Let $n = 2^i$ and rewrite $T (n)$:
<li class="fragment roll-in"> $T (2^0) = 1$ and $T (2^i) = 2T ( \frac{2^i}{2} ) + k2^i = 2T (2^{i−1}) + k2^i$
<li class="fragment roll-in">Now define a new sequence $t$ as follows: $t(i) = T (2^i)$
<li class="fragment roll-in">Then $t(0) = 1$, $t(i) = 2t(i − 1) + k2^i$
</ul>
</section>
<section>
<h2>Now Solve</h2>
<ul>
<li class="fragment roll-in">We’ve got a new recurrence: $t(0) = 1$, $t(i) = 2t(i − 1) + k2^i$
<li class="fragment roll-in">We can easily find the annihilator for this recurrence
<li class="fragment roll-in">$(\bm{L} − 2)$ annihilates the homogeneous part, $(\bm{L} − 2)$ annihilates
the non-homogeneous part, So $(\bm{L} − 2)(\bm{L} − 2)$ annihilates $t(i)$
<li class="fragment roll-in">Thus $t(i) = (c_1i + c_2)2^i$
</ul>
</section>
<section>
<h2>Reverse Transformation</h2>
<ul>
<li class="fragment roll-in">We’ve got a solution for $t(i)$ and we want to transform this
into a solution for $T (n)$
<li class="fragment roll-in">Recall that $t(i) = T (2^i)$ and $2^i = n$
\begin{align}
t(i) &\fragment{3}{= (c_1i + c_2)2^i}\\
T (2^i) &\fragment{4}{= (c_1i + c_2)2^i}\\
T (n) &\fragment{5}{= (c_1 \log n + c_2)n}\\
&\fragment{6}{= c_1n \log n + c_2n}\\
&\fragment{7}{= O(n\log n)}
\end{align}
</ul>
</section>
<section>
<h2>Success!</h2>
<div class="fragment roll-in" style="text-align:left; margin-top:-10px; width:100%;font-size:32pt;">
Let’s recap what just happened:
</div>
<ul>
<li class="fragment roll-in">We could not find the annihilator of $T (n)$ so:
<li class="fragment roll-in">We did a <alert>transformation</alert> to a recurrence we could solve, $t(i)$
(we let $n = 2^i$ and $t(i) = T (2^i)$)
<li class="fragment roll-in">We found the annihilator for $t(i)$, and solved the recurrence
for $t(i)$
<li class="fragment roll-in">We <alert>reverse transformed</alert> the solution for $t(i)$ back to a solution for $T (n)$
</ul>
</section>
<section>
<h2>Another Example</h2>
<ul>
<li class="fragment roll-in">Consider the
recurrence $T (n) = 9T ( \frac{n}{3} ) + kn$, where $T (1) = 1$ and
$k$ is some constant
<li class="fragment roll-in">Let $n = 3^i$ and rewrite $T (n)$:
<li class="fragment roll-in">$T(2^0) = 1$ and $T(3^i) = 9T (3^{i−1}) + k3^i$
<li class="fragment roll-in">Now define a sequence $t$ as follows $t(i) = T (3^i)$
<li class="fragment roll-in">Then $t(0) = 1$, $t(i) = 9t(i − 1) + k3^i$
</ul>
</section>
<section>
<h2>Now Solve</h2>
<ul>
<li class="fragment roll-in">$t(0) = 1$, $t(i) = 9t(i − 1) + k3^i$
<li class="fragment roll-in">This is annihilated by $(\bm{L} − 9)(\bm{L} − 3)$
<li class="fragment roll-in">So $t(i)$ is of the form $t(i) = c_19^i + c_23^i$
</ul>
</section>
<section>
<h2>Reverse Transformation</h2>
<ul>
<li class="fragment roll-in">$t(i) = c_19^i + c_23^i$
<li class="fragment roll-in">Recall: $t(i) = T (3^i)$ and $3^i = n$
\begin{align}
t(i) &\fragment{3}{= c_19^i + c_23^i}\\
T (3^i) &\fragment{4}{= c_19^i + c_23^i}\\
T (n) &\fragment{5}{= c_1(3^i)^2 + c_23^i}\\
&\fragment{6}{= c_1 n^2 + c_2 n}\\
&\fragment{7}{= \Theta(n^2)}
\end{align}
</ul>
</section>
<section>
<h2>In Class Exercise <img style="border:0; box-shadow: 0px 0px 0px rgba(150, 150, 255, 1);" width="100"
src="figures/dolphin_swim.webp" alt="dolphin">
</h2>
<div class="fragment roll-in" style="text-align:left; margin-top:-20px; width:100%;font-size:32pt;">
Consider the recurrence $T(n) = 2T (n/4) + kn$,
where $T (1) = 1$, and $k$ is some constant
</div>
<ul>
<li class="fragment roll-in">Q1: What is the transformed recurrence
$t(i)$? How do we rewrite $n$ and $T (n)$ to get this sequence?
<li class="fragment roll-in">Q2: What is the annihilator of $t(i)$?
What is the solution for the recurrence $t(i)$?
<li class="fragment roll-in">Q3: What is the solution for $T (n)$?
(i.e. do the reverse transformation)
</ul>
</section>
</section>
<section>
<section>
<h1>Recap</h1>
<h2>Recurrence relations</h2>
</section>
<section data-vertical-align-top>
<h2>Substitution method</h2>
</section>
<section data-vertical-align-top>
<h2>Recursion Trees</h2>
</section>
<section data-vertical-align-top>
<h2>Master theorem</h2>
</section>
<section data-vertical-align-top>
<h2>Annihilators</h2>
</section>
</section>
<section>
<h2>See you</h2>
Monday February $6^{th}$
</section>
</div>
</div>
<script src="dist/reveal.js"></script>
<!-- <link rel="stylesheet" href="lib/css/monokai.css"> -->
<script src="plugin/highlight/highlight.js"></script>
<script src="plugin/math/math.js"></script>
<script src="plugin/chalkboard/plugin.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/zoom/zoom.js"></script>
<script src="plugin/menu/menu.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
let notes = document.querySelectorAll('aside.notes');
notes.forEach(n => {
let html = n.innerHTML;
html = html.trim().replace(/\n/g, '<br/>');
n.innerHTML = html;
});
Reveal.initialize({
// history: true,
hash: true,
margin: 0.01,
minScale: 0.01,
maxScale: 1.23,
menu: {
themes: true,
openSlideNumber: true,
openButton: false,
},
customcontrols: {
slideNumberCSS : 'position: fixed; display: block; right: 90px; top: auto; left: auto; width: 50px; bottom: 30px; z-index: 31; font-family: Helvetica, sans-serif; font-size: 12px; line-height: 1; padding: 5px; text-align: center; border-radius: 10px; background-color: rgba(128,128,128,.5)',
controls: [
{ icon: '<i class="fa fa-caret-left"></i>',
css: 'position: fixed; right: 60px; bottom: 30px; z-index: 30; font-size: 24px;',
action: 'Reveal.prev(); return false;'
},
{ icon: '<i class="fa fa-caret-right"></i>',
css: 'position: fixed; right: 30px; bottom: 30px; z-index: 30; font-size: 24px;',
action: 'Reveal.next(); return false;'
}
]
},
chalkboard: {
boardmarkerWidth: 1,
chalkWidth: 2,
chalkEffect: 1,
slideWidth: Reveal.width,
slideHeight: Reveal.height,
toggleNotesButton: false,
toggleChalkboardButton: false,
//src: "chalkboards/chalkboard_em2.json",
readOnly: false,
theme: "blackboard",
eraser: { src: "plugin/chalkboard/img/sponge.png", radius: 30},
},
math: {
mathjax: 'https://cdn.jsdelivr.net/gh/mathjax/mathjax@2.7.8/MathJax.js',
config: 'TeX-AMS_SVG-full',
// pass other options into `MathJax.Hub.Config()`
TeX: {
Macros: {
RR: '\\mathbb{R}',
PP: '\\mathbb{P}',
EE: '\\mathbb{E}',
NN: '\\mathbb{N}',
vth: '\\vec{\\theta}',
loss: '{\\cal l}',
hclass: '{\\cal H}',
CD: '{\\cal D}',
def: '\\stackrel{\\text{def}}{=}',
pag: ['\\text{pa}_{{\cal G}^{#1}}(#2)}', 2],
vec: ['\\boldsymbol{\\mathbf #1}', 1],
set: [ '\\left\\{#1 \\; : \\; #2\\right\\}', 2 ],
bm: ['\\boldsymbol{\\mathbf #1}', 1],
argmin: ['\\operatorname\{arg\\,min\\,\}'],
argmax: ['\\operatorname\{arg\\,max\\,\}'],
prob: ["\\mbox{#1$\\left(#2\\right)$}", 2],
floor: ["\\lfloor #1 \\rfloor",1]
},
loader: {load: ['[tex]/color']},
extensions: ["color.js"],
tex: {packages: {'[+]': ['color']}},
svg: {
fontCache: 'global'
}
}
},
plugins: [ RevealMath, RevealChalkboard, RevealHighlight, RevealNotes, RevealZoom, RevealMenu ],
});
Reveal.configure({ fragments: true }); // set false when developing to see everything at once
Reveal.configure({ slideNumber: true });
//Reveal.configure({ history: true });
Reveal.configure({ slideNumber: 'c / t' });
Reveal.addEventListener( 'darkside', function() {
document.getElementById('theme').setAttribute('href','dist/theme/aml_dark.css');
}, false );
Reveal.addEventListener( 'brightside', function() {
document.getElementById('theme').setAttribute('href','dist/theme/aml.css');
}, false );
</script>
<style type="text/css">
/* 1. Style header/footer <div> so they are positioned as desired. */
#header-left {
position: absolute;
top: 0%;
left: 0%;
}
#header-right {
position: absolute;
top: 0%;
right: 0%;
}
#footer-left {
position: absolute;
bottom: 0%;
left: 0%;
}
</style>
<!-- // 2. Create hidden header/footer -->
<div id="hidden" style="background; display:none;">
<div id="header">
<div id="header-left"><h4>CS4520</h4></div>
<div id="header-right"><h4>Algorithms</h4></div>
<div id="footer-left">
<img style="border:0; box-shadow: 0px 0px 0px rgba(150, 150, 255, 1);" width="100"
src="figures/flowchart.png" alt="robot learning">
</div>
</div>
</div>
<script type="text/javascript">
// 3. On Reveal.js ready event, copy header/footer <div> into each `.slide-background` <div>
var header = $('#header').html();
if ( window.location.search.match( /print-pdf/gi ) ) {
Reveal.addEventListener( 'ready', function( event ) {
$('.slide-background').append(header);
});
}
else {
$('div.reveal').append(header);
}
</script>
</body>
</html>