-
Notifications
You must be signed in to change notification settings - Fork 0
/
dsa_12_dictionary.html
577 lines (530 loc) · 25.1 KB
/
dsa_12_dictionary.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
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
<!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>
<script type="module" src="js/wc_code/wc-code.js"></script>
<!--Popup Window CSS-->
<style media="screen">
*,*:before,*:after{
padding: 0;
margin: 0;
box-sizing: border-box;
}
.popup{
background-color: #fdf6e3;
width: 80%;
padding: 30px 40px;
position: absolute;
transform: translate(-50%,-50%);
left: 50%;
top: 50%;
border-radius: 8px;
font-family: "Poppins",sans-serif;
display: none;
z-index: 1000;
text-align: left;
max-height: 90%;
overflow: scroll;
}
.popup button{
display: block;
margin: 0 0 20px auto;
background-color: transparent;
font-size: 30px;
color: #fdf6e3;
background: #03549a;
border-radius: 100%;
width: 40px;
height: 40px;
border: none;
outline: none;
cursor: pointer;
}
</style>
</head>
<body>
<div class="popup" id="div4code.1">
<!-- <button id="close">×</button> -->
<wc-code-zone mode="python">
<wc-code style="font-size: 14pt;" theme="monokai" mode="python" file-name="python-file.py">
<script type="wc-content">
import numpy as np
print(np.__version__ )
# try writing your solution here. This is a functional python console
</script>
</wc-code>
</wc-code-zone>
</div>
<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>12: Dictionary</h1>
<p>
</section>
<section>
<h3>Outline of the lecture</h3>
<ul>
<li class="fragment roll-in"> Linear time sorting algorithms
<li class="fragment roll-in"> Dictionary
</ul>
</section>
</section>
<section>
<section data-background="figures/count_sort_papers.svg" data-background-size="cover">
<h1>Linear-Time Sorting algorithms</h1>
</section>
<section data-vertical-align-top data-background="figures/counting_sort.gif" data-background-size="cover">
<h2>Counting sort</h2>
</section>
<section data-vertical-align-top data-background="figures/radix_sort.svg" data-background-size="contain">
<h2>Radix sort</h2>
</section>
</section>
<section>
<section data-background="figures/dictionary_page.jpeg">
<h1 style="text-shadow: 4px 4px 4px #002b36; color: #f1f1f1; margin-top: -100px;">Dictionary ADT</h1>
</section>
<section>
<h2></h2>
A dictionary ADT implements the following operations
<ul>
<li class="fragment roll-in"><b><code>Insert(x)</code></b>: puts the item $x$ into the dictionary
<li class="fragment roll-in"><b><code>Delete(x)</code></b>: deletes the item $x$ from the dictionary
<li class="fragment roll-in"><b><code>IsIn(x)</code></b>: returns true $\iff$ the item $x$ is in the dictionary
</ul>
</section>
<section>
<h2></h2>
<ul>
<li class="fragment roll-in">Frequently, we think of the items being stored in the dictionary as keys
<li class="fragment roll-in">The keys typically have records associated with them which
are carried around with the key but not used by the ADT
implementation
<li class="fragment roll-in">Thus we can implement functions like:
<ul>
<li class="fragment roll-in"><b><code>Insert(k,r)</code></b>: puts the item $(k,r)$ into the dictionary if the
key $k$ is not already there, otherwise returns an error
<li class="fragment roll-in"><b><code>Delete(k)</code></b>: deletes the item with key $k$ from the dictionary
<li class="fragment roll-in"><b><code>Lookup(k)</code></b>: returns the item $(k,r)$ if $k$ is in the dictionary,
otherwise returns <code>null</code>
</ul>
</ul>
</section>
<section>
<h2></h2>
<ul style="margin-top: -40px; width: 110%">
<li class="fragment roll-in">The simplest way to implement a dictionary ADT is with a
linked list
<li class="fragment roll-in">Let $l$ be a linked list data structure, assume we have the
following operations defined for $l$
<ul>
<li class="fragment roll-in"><b><code>head(l)</code></b>: returns a pointer to the head of the list
<li class="fragment roll-in"><b><code>next(p)</code></b>: given a pointer $p$ into the list, returns a pointer
to the next element in the list if such exists, null otherwise
<li class="fragment roll-in"><b><code>previous(p)</code></b>: given a pointer $p$ into the list, returns a
pointer to the previous element in the list if such exists,
<code>null</code> otherwise
<li class="fragment roll-in"><b><code>key(p)</code></b>: given a pointer into the list, returns the key value
of that item
<li class="fragment roll-in"><b><code>record(p)</code></b>: given a pointer into the list, returns the record
value of that item
</ul>
</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>
Implement a dictionary with a linked list
<ul>
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span>1: Write the operation <b><code>Lookup(k)</code></b> which returns a pointer
to the item with key $k$ if it is in the dictionary or <code>null</code> otherwise
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span> 2: Write the operation <b><code>Insert(k,r)</code></b>
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span>3: Write the operation <b><code>Delete(k)</code></b>
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span>4: For a dictionary with $n$ elements, what is the runtime
of all of these operations for the linked list data structure?
</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" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span> 5: Describe how you would use this dictionary ADT to
count the number of occurences of each word in an online
book.
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span> 6: If $m$ is the total number of words in the online book,
and $n$ is the number of unique words, what is the runtime of
the algorithm for the previous question?
</ul>
</section>
<section id="code.1">
</section>
<section>
<h2>Dictionaries</h2>
<ul>
<li class="fragment roll-in">This linked list implementation of dictionaries is very slow
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span> Can we do better?
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-a"></i></span> Yes, with hash tables, AVL trees, etc
</ul>
</section>
<section>
<h2>Hash Tables</h2>
Hash Tables implement the Dictionary ADT, namely:
<ul>
<li class="fragment roll-in"><b><code>Insert(x)</code></b> - $O(1)$ expected time, $\Theta(n)$ worst case
<li class="fragment roll-in"><b><code>Lookup(x)</code></b> - $O(1)$ expected time, $\Theta(n)$ worst case
<li class="fragment roll-in"><b><code>Delete(x)</code></b> - $O(1)$ expected time, $\Theta(n)$ worst case
</ul>
</section>
<section>
<h2>Direct Addressing</h2>
<ul>
<li class="fragment roll-in">Suppose universe of keys is $U = \{0, 1,
\dots , m − 1\}$, where m is not too large
<li class="fragment roll-in">Assume no two elements have the same key
<li class="fragment roll-in">We use an array <code>T[0:m−1]</code> to store the keys
<li class="fragment roll-in">Slot $k$ contains the element with key $k$
</ul>
</section>
<section>
<h2>Direct Address Functions</h2>
<ul>
<li class="fragment roll-in"><code><b>da_search(T,k)</b>{ return T[k];}</code>
<li class="fragment roll-in"><code><b>da_insert(T,x)</b>{ T[key(x)] = x;}</code>
<li class="fragment roll-in"><code><b>da_delete(T,x)</b>{ T[key(x)] = None;}</code>
<li class="fragment roll-in" style="list-style: none;">Each of these operations takes $O(1)$ time
</ul>
</section>
<section>
<h2>Direct Addressing Problem</h2>
<ul>
<li class="fragment roll-in">If universe $U$ is large, storing the array $T$ may be impractical
<li class="fragment roll-in">Also much space can be wasted in $T$ if number of objects
stored is small
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span>
Can we do better?
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-a"></i></span>Yes we can trade time for space
</ul>
</section>
<section>
<h2>Hash Tables</h2>
<ul>
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-solid fa-key"></i></span>“Key” Idea: An element with key $k$ is stored in slot $h(k)$,
where $h$ is a hash function mapping $U$ into the set $\{0, \dots , m−
1\}$
<li class="fragment roll-in">Main problem: Two keys can now hash to the same slot
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span> How do we resolve this problem?
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-a"></i> <i class="fa-solid fa-1"></i></span>Try to prevent it by hashing keys to “random” slots and
making the table large enough
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-a"></i> <i class="fa-solid fa-2"></i></span> Chaining <i class="fa-solid fa-link"></i>
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-a"></i><i class="fa-solid fa-3"></i></span>Open Addressing
</ul>
</section>
<section>
<h2>Chained Hash <i class="fa-solid fa-link"></i></h2>
<ul>
<li class="fragment roll-in">In chaining, all elements that hash to the same slot are put in a
linked list.
<li class="fragment roll-in"><code><b>ch_insert(T,x)</b>{Insert x at the head of list T[h(key(x))];}</code>
<li class="fragment roll-in"><code><b>ch_search(T,k)</b>{search for elem with key k in list T[h(k)];}</code>
<li class="fragment roll-in"><code><b>ch_delete(T,x)</b>{delete x from the list T[h(key(x))];}</code>
</ul>
</section>
<section>
<h2>Analysis</h2>
<ul>
<li class="fragment roll-in"><code><b>ch_insert</b></code> and <code><b>ch_delete</b></code> take $O(1)$ time if the list is doubly
linked and there are no duplicate keys
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span> How long does <code><b>ch_search</b></code> take?
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-a"></i></span>It depends. In particular, depends on the load factor,
$\alpha = \frac{n}{m}$ (i.e. average number of elems in a list)
</ul>
</section>
<section>
<h2><code>ch_search</code> Analysis</h2>
<ul>
<li class="fragment roll-in">Worst case analysis: everyone hashes to one slot so $\Theta(n)$
<li class="fragment roll-in">For average case, make the <em>simple uniform hashing assumption</em>: any given elem is equally likely to hash into any of the $m$ slots, indep. of the other elems
<li class="fragment roll-in">Let $n_i$ be a random variable giving the length of the list at
the $i^{th}$ slot
<li class="fragment roll-in">Then time to do a search for key $k$ is $1 + n_{h(k)}$
</ul>
</section>
<section>
<h2><code>ch_search</code> Analysis</h2>
<ul>
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span> What is $\prob{E}{n_{h(k)}}$?
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-a"></i></span>We know that $h(k)$ is uniformly distributed among $\{0, \dots , m−1\}$
<li class="fragment roll-in" style="list-style:none;">
<blockquote style="text-align: center; background-color: #93a1a1; color: #fdf6e3; font-size: 42px; width: 100%;">
Thus $\prob{E}{n_{h(k)}} = \sum_{i=0}^{m-1} (1/m)n_i = n/m = \alpha$
</blockquote>
</ul>
</section>
<section>
<h2>Hash Functions</h2>
<ul>
<li class="fragment roll-in">Want each key to be equally likely to hash to any of the $m$
slots, independently of the other keys
<li class="fragment roll-in">Key idea is to use the hash function to “break up” any patterns that might exist in the data
<li class="fragment roll-in">We will always assume a key is a natural number (can e.g.
easily convert strings to naturaly numbers)
</ul>
</section>
<section>
<h2>desired properties of hash functions</h2>
<ul>
<li class="fragment roll-in"> Uniformity $\prob{P}{h(k)=i} = \frac{1}{m}$ for all $k$ and $i$
<li class="fragment roll-in"> Universality $\prob{P}{h(x) = h(y)}\leq \frac{1}{m}$ for all $x \ne y$
<li class="fragment roll-in"> Near universality $\prob{P}{h(x) = h(y)} \leq \frac{2}{m} \forall x \ne y$
</ul>
</section>
<section>
<h2>Division Method</h2>
<ul>
<li class="fragment roll-in">$h(k) = k \mod m$
<li class="fragment roll-in">Want $m$ to be a prime number, which is not too close to a power of $2$
<li class="fragment roll-in" style="list-style:none;"> <span class="fa-li"><i class="fa-regular fa-circle-question"></i></span>Why?
</ul>
</section>
<section>
<h2>Multiplication Method</h2>
<ul>
<li class="fragment roll-in">$h(k) = \lfloor m \times (a k \mod 1) \rfloor$
<li class="fragment roll-in"> parameter $a$ is called a <em>salt</em>
<li class="fragment roll-in">$ak \mod 1$ means the fractional part of $ak$
<li class="fragment roll-in">Advantage: value of $m$ is not critical, need not be a prime
<li class="fragment roll-in">$a = (\sqrt{5} − 1)/2$ works well in practice
</ul>
</section>
<section>
<h2>Multiplicative hashing</h2>
<ul>
<li class="fragment roll-in"> Prime multiplicative hashing $h(k) = (ak \mod p) \mod m$, where $p$ is a prime number $p > |U|$ (near-universal)
<li class="fragment roll-in"> Modified prime multiplicative hashing $h(k) = ((ak + b) \mod p) \mod m$, where $p$ and $b$ is a prime number $p > |U|$ (universal)
<li class="fragment roll-in"> Binary multiplicative hashing
$$
h(k) = \floor{\frac{(ak) \mod 2^w}{2^{w-l}}}
$$
</ul>
</section>
<section>
<h2>binary Multiplicative hashing</h2>
<ul>
<li class="fragment roll-in"> Binary multiplicative hashing is near-universal
$$
h(k) = \floor{\frac{(ak) \mod 2^w}{2^{w-l}}}
$$
</ul>
<row class="fragment roll-in">
<col50>
<img src="figures/binary_hash.svg" alt="Algorithms" style="border:0; box-shadow: 0px 0px 0px rgba(150, 150, 255, 1); margin-bottom: -5%" width="100%" >
</col50>
<col50>
<pre class="python fragment roll-in" style="width: 99%; font-size: 20pt;"><code data-trim data-noescape data-line-numbers>
def hash(k, salt=4):
return salt * k >> 64
</code></pre>
<div style="text-align: left; font-size: 22pt;">
Note, in actual implementation <code>salt</code> should be a random integer that is chosen once for the entire hash table.
</div>
</col50>
</row>
</section>
<section>
<h1>to be continued</h1>
</section>
</section>
<section>
<h2>See you</h2>
Wednesday February $22^{nd}$
</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 type="text/javascript">
// Event start load section on slide
Reveal.addEventListener('slidechanged', function(event) {
//-- check if current slide with code
var sectionID = Reveal.getCurrentSlide().id;
if(sectionID === "code.1") {
document.getElementById("div4code.1").style.display = "block";
} else {
document.getElementById("div4code.1").style.display = "none"
}
});
</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>