501 slides

pull/2/head
Oliver Kennedy 2022-09-20 16:01:19 -04:00
parent 017892d324
commit 86d16c0132
Signed by: okennedy
GPG Key ID: 3E5F9B3ABD3FDB60
5 changed files with 43693 additions and 4 deletions

View File

@ -252,7 +252,6 @@ schedule:
- date: 09/16/22
topic: ADTs, Sequences, Arrays
dow: Fri
due: PA1
section_a:
slides: slide/lec08a.pdf
section_b:
@ -261,6 +260,7 @@ schedule:
lectures:
- date: 09/19/22
topic: ArrayBuffer, Amortized Runtime, and Option types
due: PA1
dow: Mon
section_a:
slides: slide/lec09a.pdf
@ -274,7 +274,8 @@ schedule:
- date: 09/23/22
topic: Recursion Intro
dow: Fri
due: WA0
section_b:
slides: slide/10b-Recursion.html
- week: 5
lectures:
- date: 09/26/22
@ -283,6 +284,7 @@ schedule:
- date: 09/28/22
topic: Recursive Analysis (contd...)
dow: Wed
due: WA0
- date: 09/30/22
topic: Data-Bounded Analysis
dow: Fri

View File

@ -0,0 +1,165 @@
---
template: templates/cse250_2022_slides.erb
title: Recursion
date: Sept 21, 2022
textbook: tbd
---
<section>
<svg data-src="graphics/10b/matroska.svg" class="stretch"/>
<attribution><a href="https://www.etsy.com/listing/916447505/ukrainian-nesting-doll-nesting-dolls">Ukranian Nesting Doll Nesting Dolls Handmade Dolls | Etsy</a>
</section>
<section>
<h4 class="slide_title">Factorial</h4>
<pre><code>
def factorial(n: Int): Long =
if(n <= 1){ 1 }
else { n * factorial(n-1) }
</code></pre>
</section>
<section>
<h4 class="slide_title">Factorial</h4>
<b>Base Case:</b>
<pre><code>
if(n <= 1){ 1 }
</code></pre>
<b>Recursive Case:</b>
<pre><code>
else { n * factorial(n-1) }
</code></pre>
</section>
<section>
<h4 class="slide_title">Fibonacci</h4>
<p>
1, 1,
<span class="fragment">2, </span>
<span class="fragment">3, </span>
<span class="fragment">5, </span>
<span class="fragment">8, </span>
<span class="fragment">13, </span>
<span class="fragment">21, </span>
</p>
</section>
<section>
<h4 class="slide_title">Fibonacci</h4>
<pre><code>
def fibb(n: Int): Long =
if(n < 2){ 1 }
else { fibb(n-1) + fibb(n-2) }
</code></pre>
</section>
<section>
<h4 class="slide_title">Fibonacci</h4>
<b>Base Case:</b>
<pre><code>
if(n < 2){ 1 }
</code></pre>
<b>Recursive Case:</b>
<pre><code>
else { fibb(n-1) + fibb(n-2) }
</code></pre>
</section>
<section>
<h4 class="slide_title">Towers of Hanoi</h4>
<p>Live demo!</p>
</section>
<section>
<h4 class="slide_title">Towers of Hanoi</h4>
<pre><code>
var towers = Array(new Stack(), new Stack(), new Stack())
def moveFrom(fromTower: Int, toTower: Int, numDisks: Int): Unit =
{
val otherTower = (Set(0, 1, 2) - fromTower - toTower).head
if(numDisks < 0){
return
} else if(numDisks == 1){
moveTopDisk(from = fromTower, to = toTower)
} else {
moveFrom(fromTower, otherTower, numDisks-1)
moveTopDisk(from = fromTower, to = toTower)
moveFrom(otherTower, toTower, numDisks-1)
}
}
</code></pre>
</section>
<section>
<h4 class="slide_title">Factorial</h4>
<p>What's the complexity? (in terms of <tt>n</tt>)</p>
<pre><code>
def factorial(n: Int): Long =
if(n <= 1){ 1 }
else { n * factorial(n-1) }
</code></pre>
</section>
<section>
<h4 class="slide_title">Factorial</h4>
$$T(n) = \begin{cases}
\Theta(1) & \textbf{if } n \leq 0\\
T(n-1) + \Theta(1) & \textbf{otherwise}
\end{cases}$$
</section>
<section>
<h4 class="slide_title">Fibonacci</h4>
<b>Base Case:</b>
$$\Theta(1) \textbf{ if } n < 2$$
<b>Recursive Case"</b>
$$T(n-1) + \Theta(1) \textbf{ otherwise}$$
</section>
<section>
<h4 class="slide_title">Factorial</h4>
$$T(n) = \begin{cases}
\Theta(1) & \textbf{if } n \leq 0\\
T(n-1) + \Theta(1) & \textbf{otherwise}
\end{cases}$$
<p>Solve for $T(n)$</p>
</section>
<section>
<h4 class="slide_title">Fibonacci</h4>
<p>What's the complexity? (in terms of <tt>n</tt>)</p>
<pre><code>
def fibb(n: Int): Long =
if(n < 2){ 1 }
else { fibb(n-1) + fibb(n-2) }
</code></pre>
</section>
<section>
<h4 class="slide_title">Fibonacci</h4>
$$T(n) = \begin{cases}
\Theta(1) & \textbf{if } n < 2
T(n-1) + T(n-2) + \Theta(1) & \textbf{otherwise}
\end{cases}$$
</section>

View File

@ -1,7 +1,7 @@
---
template: templates/cse250_2022_slides.erb
title: ArrayBuffers, Amortized Analysis
date: Sept 18, 2022
date: Sept 19, 2022
textbook: "Ch. 6.4"
---

View File

@ -1,7 +1,7 @@
---
template: templates/cse250_2022_slides.erb
title: Linked Lists and Iterators
date: Sept 18, 2022
date: Sept 21, 2022
textbook: "Ch. 7"
---

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 3.2 MiB