Merge branch 'master' of gram.cse.buffalo.edu:ODIn/Website
commit
0b5b8a5528
|
@ -269,11 +269,15 @@ schedule:
|
|||
- date: 09/21/22
|
||||
topic: Linked Lists and Iterators
|
||||
dow: Wed
|
||||
section_a:
|
||||
slides: slide/lec10a.pdf
|
||||
section_b:
|
||||
slides: slide/9b-LinkedListIterator.html
|
||||
- date: 09/23/22
|
||||
topic: Recursion Intro
|
||||
dow: Fri
|
||||
section_a:
|
||||
slides: slide/lec11a.pdf
|
||||
section_b:
|
||||
slides: slide/10b-Recursion.html
|
||||
- week: 5
|
||||
|
@ -286,11 +290,10 @@ schedule:
|
|||
- date: 09/28/22
|
||||
topic: Recursive Analysis (contd...)
|
||||
dow: Wed
|
||||
due: WA0
|
||||
due: WA1
|
||||
- date: 09/30/22
|
||||
topic: Data-Bounded Analysis
|
||||
dow: Fri
|
||||
due: WA1
|
||||
- week: 6
|
||||
lectures:
|
||||
- date: 10/03/22
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
template: templates/cse250_2022_slides.erb
|
||||
title: Recursion
|
||||
date: Sept 21, 2022
|
||||
date: Sept 23, 2022
|
||||
textbook: Ch. 15
|
||||
---
|
||||
|
||||
|
@ -10,10 +10,30 @@ textbook: Ch. 15
|
|||
<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>
|
||||
<p>Computational problems can be recursive too!</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Factorial</h4>
|
||||
|
||||
<pre><code>
|
||||
<p class="fragment">
|
||||
$439!$ <span class="fragment">$= 439 \cdot 438!$</span>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Factorial</h4>
|
||||
|
||||
<p><b>Recursive Case: </b> $n! = n \cdot (n-1)!$</p>
|
||||
<p class="fragment"><b>Base Case: </b> $1! = 1$</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Factorial</h4>
|
||||
|
||||
<pre><code class="scala">
|
||||
def factorial(n: Int): Long =
|
||||
if(n <= 1){ 1 }
|
||||
else { n * factorial(n-1) }
|
||||
|
@ -24,12 +44,12 @@ textbook: Ch. 15
|
|||
<h4 class="slide_title">Factorial</h4>
|
||||
|
||||
<b>Base Case:</b>
|
||||
<pre><code>
|
||||
<pre><code class="scala">
|
||||
if(n <= 1){ 1 }
|
||||
</code></pre>
|
||||
|
||||
<b>Recursive Case:</b>
|
||||
<pre><code>
|
||||
<pre><code class="scala">
|
||||
else { n * factorial(n-1) }
|
||||
</code></pre>
|
||||
</section>
|
||||
|
@ -51,11 +71,18 @@ textbook: Ch. 15
|
|||
|
||||
<section>
|
||||
<h4 class="slide_title">Fibonacci</h4>
|
||||
|
||||
<p><b>Base Cases:</b> $\texttt{fib}(1) = 1$, $\texttt{fib}(2) = 1$</p>
|
||||
<p><b>Recursive Cases:</b> $\texttt{fib}(n) = \texttt{fib}(n-1) + \texttt{fib}(n-2)$</p>
|
||||
</section>
|
||||
|
||||
<pre><code>
|
||||
def fibb(n: Int): Long =
|
||||
<section>
|
||||
<h4 class="slide_title">Fibonacci</h4>
|
||||
|
||||
<pre><code class="scala">
|
||||
def fib(n: Int): Long =
|
||||
if(n < 2){ 1 }
|
||||
else { fibb(n-1) + fibb(n-2) }
|
||||
else { fib(n-1) + fib(n-2) }
|
||||
</code></pre>
|
||||
</section>
|
||||
|
||||
|
@ -63,13 +90,13 @@ textbook: Ch. 15
|
|||
<h4 class="slide_title">Fibonacci</h4>
|
||||
|
||||
<b>Base Case:</b>
|
||||
<pre><code>
|
||||
<pre><code class="scala">
|
||||
if(n < 2){ 1 }
|
||||
</code></pre>
|
||||
|
||||
<b>Recursive Case:</b>
|
||||
<pre><code>
|
||||
else { fibb(n-1) + fibb(n-2) }
|
||||
<pre><code class="scala">
|
||||
else { fib(n-1) + fib(n-2) }
|
||||
</code></pre>
|
||||
</section>
|
||||
|
||||
|
@ -82,32 +109,71 @@ textbook: Ch. 15
|
|||
<section>
|
||||
<h4 class="slide_title">Towers of Hanoi</h4>
|
||||
|
||||
<pre><code>
|
||||
<p><b>Task:</b> Move $n$ blocks from <b>A</b> to <b>C</b></p>
|
||||
|
||||
<p><b><u>Base Case</u></b> ($n=1$)
|
||||
<ol>
|
||||
<li>Move the block from <b>A</b> to <b>C</b></li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
<p><b><u>Recursive Case</u></b> ($n \geq 2$)
|
||||
<ol>
|
||||
<li>Move $n-1$ blocks from <b>A</b> to <b>B</b></li>
|
||||
<li>Move the bottom block from <b>A</b> to <b>C</b></li>
|
||||
<li>Move $n-1$ blocks from <b>B</b> to <b>C</b></li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Towers of Hanoi</h4>
|
||||
|
||||
<pre><code class="scala">
|
||||
var towers = Array(new Stack(), new Stack(), new Stack())
|
||||
|
||||
def moveFrom(fromTower: Int, toTower: Int, numDisks: Int): Unit =
|
||||
def move(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)
|
||||
if(numDisks == 1){
|
||||
moveOne(from = fromTower, to = toTower)
|
||||
} else {
|
||||
moveFrom(fromTower, otherTower, numDisks-1)
|
||||
moveTopDisk(from = fromTower, to = toTower)
|
||||
moveFrom(otherTower, toTower, numDisks-1)
|
||||
move(fromTower, otherTower, numDisks-1)
|
||||
moveOne(from = fromTower, to = toTower)
|
||||
move(otherTower, toTower, numDisks-1)
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p>How do we get the complexity of recursive algorithms?</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Factorial</h4>
|
||||
|
||||
<p>What's the complexity? (in terms of <tt>n</tt>)</p>
|
||||
|
||||
<pre><code>
|
||||
<pre><code class="scala">
|
||||
def factorial(n: Int): Long =
|
||||
if(n <= 1){ 1 }
|
||||
else { n * factorial(n-1) }
|
||||
</code></pre>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p><b>Idea:</b> Write down a recursive runtime growth function</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Factorial</h4>
|
||||
|
||||
<p>What's the complexity? (in terms of <tt>n</tt>)</p>
|
||||
|
||||
<pre><code class="scala">
|
||||
def factorial(n: Int): Long =
|
||||
if(n <= 1){ 1 }
|
||||
else { n * factorial(n-1) }
|
||||
|
@ -124,13 +190,16 @@ textbook: Ch. 15
|
|||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Fibonacci</h4>
|
||||
<h4 class="slide_title">Factorial</h4>
|
||||
<p>
|
||||
<b><u>Base Case</u></b> ($n \leq 0$)
|
||||
$$\Theta(1)$$
|
||||
</p>
|
||||
|
||||
<b>Base Case:</b>
|
||||
$$\Theta(1) \textbf{ if } n < 2$$
|
||||
|
||||
<b>Recursive Case"</b>
|
||||
$$T(n-1) + \Theta(1) \textbf{ otherwise}$$
|
||||
<p>
|
||||
<b><u>Recursive Case</u></b> ($n > 0$)
|
||||
$$T(n-1) + \Theta(1)$$
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
@ -152,30 +221,30 @@ textbook: Ch. 15
|
|||
<p><b>Approach:</b>
|
||||
<ol>
|
||||
<li>Generate a Hypothesis (🔮)</li>
|
||||
<li>Prove the Hypothesis for the Base Case (🏡)</li>
|
||||
<li>Prove the Hypothesis Inductively (🏢)</li>
|
||||
<li>Prove the Hypothesis for the Base Case</li>
|
||||
<li>Prove the Hypothesis Inductively</li>
|
||||
</ol>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Generate a Hypothesis (🔮)</h4>
|
||||
<h4 class="slide_title">Generate a Hypothesis</h4>
|
||||
|
||||
<p><b>Approach:</b> Write out the rule for increasing $n$</p>
|
||||
|
||||
<p>
|
||||
$\Theta(1)$,
|
||||
<span class="fragment">$2\Theta(1)$ </span>
|
||||
<span class="fragment">$3\Theta(1)$ </span>
|
||||
<span class="fragment">$4\Theta(1)$ </span>
|
||||
<span class="fragment">$5\Theta(1)$ </span>
|
||||
<span class="fragment">$6\Theta(1)$ </span>
|
||||
<span class="fragment">$7\Theta(1)$ </span>
|
||||
<span class="fragment">$2\Theta(1)$, </span>
|
||||
<span class="fragment">$3\Theta(1)$, </span>
|
||||
<span class="fragment">$4\Theta(1)$, </span>
|
||||
<span class="fragment">$5\Theta(1)$, </span>
|
||||
<span class="fragment">$6\Theta(1)$, </span>
|
||||
<span class="fragment">$7\Theta(1)$, $\ldots$ </span>
|
||||
</p>
|
||||
|
||||
<p class="fragment">What's the pattern?</p>
|
||||
|
||||
<p class="fragment"><b>Hypothesis: </b> $T(n) \in O(n)$ (there is some $c > 0$ such that $T(n) \leq c \cdot n$)</p>
|
||||
<p class="fragment"><b>Hypothesis: </b> $T(n) \in O(n)$<br> (there is some $c > 0$ such that $T(n) \leq c \cdot n$)</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
@ -192,16 +261,16 @@ textbook: Ch. 15
|
|||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Prove the Hypothesis for the Base Case (🏡)</h4>
|
||||
<h4 class="slide_title">Prove the Hypothesis for the Base Case</h4>
|
||||
|
||||
<p>$T(1) \leq c \cdot 1$</p>
|
||||
<p class="fragment">$T(1) \leq c$</p>
|
||||
<p class="fragment">$c_0 \leq c$</p>
|
||||
<p class="fragment">True for any $c \geq c_0</p>
|
||||
<p class="fragment">True for any $c \geq c_0$</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Prove the Hypothesis for the Base Case+1 (🏡)</h4>
|
||||
<h4 class="slide_title">Prove the Hypothesis for the Base Case+1</h4>
|
||||
|
||||
<p>$T(2) \leq c \cdot 2$</p>
|
||||
<p class="fragment">$T(1) + c_1 \leq 2c$</p>
|
||||
|
@ -211,21 +280,21 @@ textbook: Ch. 15
|
|||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Prove the Hypothesis for the Base Case+2 (🏡)</h4>
|
||||
<h4 class="slide_title">Prove the Hypothesis for the Base Case+2</h4>
|
||||
|
||||
<p>$T(3) \leq c \cdot 3$</p>
|
||||
<p class="fragment">$T(2) + c_1 \leq 3c$</p>
|
||||
<p class="fragment">We know there's a $c$ s.t. $T(2) \leq 2c$, so if we show that $2c + c_1 \leq 3c$, then $T(2) + c_1 \leq 2c + c_1 \leq 3c$</p>
|
||||
<p class="fragment">We know there's a $c$ s.t. $T(2) \leq 2c$,<br>... so if we show that $2c + c_1 \leq 3c$, then $T(2) + c_1 \leq 2c + c_1 \leq 3c$</p>
|
||||
<p class="fragment">$c_1 \leq c$</p>
|
||||
<p class="fragment">True for any $c \geq c_1$</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Prove the Hypothesis for the Base Case+3 (🏡)</h4>
|
||||
<h4 class="slide_title">Prove the Hypothesis for the Base Case+3</h4>
|
||||
|
||||
<p>$T(4) \leq c \cdot 4$</p>
|
||||
<p>$T(3) + c_1 \leq 4c$</p>
|
||||
<p>We know there's a $c$ s.t. $T(3) \leq 3c$, so if we show that $3c + c_1 \leq 4c$, then $T(3) + c_1 \leq 3c + c_1 \leq 4c$</p>
|
||||
<p>We know there's a $c$ s.t. $T(3) \leq 3c$, <br>...so if we show that $3c + c_1 \leq 4c$, then $T(3) + c_1 \leq 3c + c_1 \leq 4c$</p>
|
||||
<p>$c_1 \leq c$</p>
|
||||
<p>True for any $c \geq c_1$</p>
|
||||
</section>
|
||||
|
@ -235,22 +304,29 @@ textbook: Ch. 15
|
|||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Prove the Hypothesis Inductively (🏢)</h4>
|
||||
<h4 class="slide_title">Prove the Hypothesis Inductively</h4>
|
||||
|
||||
<p><b>Approach:</b> Assume the hypothesis is true for any $n' < n$; use that to prove for $n$</p>
|
||||
|
||||
<p class="fragment"><b>Assume: </b>There is a $c > 0$ s.t. $T(n-1) \leq c\cdot (n-1)$</p>
|
||||
<p class="fragment"><b>Prove: </b>There is a $c > 0$ s.t. $T(n) \leq c\cdot n$</p>
|
||||
<p class="fragment">$T(n-1) + c_1 \leq c \cdot n$</p>
|
||||
<p class="fragment">By the inductive assumption, there is a $c$ s.t. $T(n-1) \leq (n-1)c$, so if we show that $(n-1)c + c_1 \leq nc$, then $T(n-1) + c_1 \leq (n-1)c + c_1 \leq nc$</p>
|
||||
<p class="fragment">$c_1 \leq c$</p>
|
||||
<p class="fragment">True for any $c \geq c_1$</p>
|
||||
<p><b>Approach:</b> Assume the hypothesis is true for any $n' < n$;<br> use that to prove for $n$</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Prove the Hypothesis Inductively</h4>
|
||||
|
||||
<div style="font-size: 90%">
|
||||
<p><b>Assume: </b>There is a $c > 0$ s.t. $T(n-1) \leq c\cdot (n-1)$</p>
|
||||
<p><b>Prove: </b>There is a $c > 0$ s.t. $T(n) \leq c\cdot n$</p>
|
||||
<p class="fragment">$T(n-1) + c_1 \leq c \cdot n$</p>
|
||||
<p class="fragment" style="font-size: 80%">By the inductive assumption, there is a $c$ s.t. $T(n-1) \leq (n-1)c$, so if we show that $(n-1)c + c_1 \leq nc$, then $T(n-1) + c_1 \leq (n-1)c + c_1 \leq nc$</p>
|
||||
<p class="fragment">$(n-1)c + c_1 - (n-1)c \leq nc - (n-1)c$</p>
|
||||
<p class="fragment">$c_1 \leq c $</p>
|
||||
<p class="fragment">True for any $c \geq c_1$</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Factorial</h4>
|
||||
|
||||
<pre><code>
|
||||
<pre><code class="scala">
|
||||
def factorial(n: Int): Long =
|
||||
if(n <= 1){ 1 }
|
||||
else { n * factorial(n-1) }
|
||||
|
@ -260,19 +336,20 @@ textbook: Ch. 15
|
|||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">The Call Stack</h4>
|
||||
<svg data-src="graphics/10b/callstack.svg"/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">Tail Recursion</h4>
|
||||
|
||||
<pre><code>
|
||||
<pre><code class="scala">
|
||||
def factorial(n: Int): Long =
|
||||
if(n <= 1){ 1 }
|
||||
else { n * factorial(n-1) }
|
||||
</code></pre>
|
||||
<p class="fragment">↳ the compiler can (sometimes) figure this out on its own ↴</p>
|
||||
<pre><code>
|
||||
<p class="fragment" style="font-size: 80%">↳ the compiler can (sometimes) figure this out on its own ↴</p>
|
||||
<pre><code class="scala">
|
||||
def factorial(n: Int): Long =
|
||||
{
|
||||
var total = 1l
|
||||
|
@ -300,10 +377,10 @@ textbook: Ch. 15
|
|||
<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 =
|
||||
<pre><code class="scala">
|
||||
def fib(n: Int): Long =
|
||||
if(n < 2){ 1 }
|
||||
else { fibb(n-1) + fibb(n-2) }
|
||||
else { fib(n-1) + fib(n-2) }
|
||||
</code></pre>
|
||||
</section>
|
||||
|
||||
|
@ -311,7 +388,7 @@ textbook: Ch. 15
|
|||
<h4 class="slide_title">Fibonacci</h4>
|
||||
|
||||
$$T(n) = \begin{cases}
|
||||
\Theta(1) & \textbf{if } n < 2
|
||||
\Theta(1) & \textbf{if } n < 2\\
|
||||
T(n-1) + T(n-2) + \Theta(1) & \textbf{otherwise}
|
||||
\end{cases}$$
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ textbook: "Ch. 7"
|
|||
<dd><b>Cons:</b> $O(n)$ <tt>remove</tt>, <tt>insert</tt>, <tt>append</tt></dd>
|
||||
|
||||
<dt>ArrayBuffer[T]</dt>
|
||||
<dd><b>Pros:</b> $O(1)$ <tt>apply</tt>, <tt>update</tt>, <tt>remove</tt></dd>
|
||||
<dd><b>Cons:</b> Amortized $O(1)$ <tt>insert</tt>, <tt>append</tt></dd>
|
||||
<dd><b>Pros:</b> $O(1)$ <tt>apply</tt>, <tt>update</tt>, Amortized $O(1)$ <tt>append</tt></dd>
|
||||
<dd><b>Cons:</b> $O(n)$ <tt>remove</tt>, <tt>insert</tt></dd>
|
||||
|
||||
<div class="fragment">
|
||||
<dt>List[T] (linked list)</dt>
|
||||
|
@ -24,6 +24,10 @@ textbook: "Ch. 7"
|
|||
</dl>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<svg data-src="graphics/09b/linked-list-example.svg"/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">mutable.List[T] : mutable.Seq[T]</h4>
|
||||
|
||||
|
@ -44,8 +48,6 @@ textbook: "Ch. 7"
|
|||
</code></pre>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">The <tt>mutable.Seq</tt> ADT</h4>
|
||||
|
||||
|
@ -73,8 +75,8 @@ textbook: "Ch. 7"
|
|||
def length: Int =
|
||||
{
|
||||
var i = 0
|
||||
var curr = head
|
||||
while(curr.isDefined){ i += 1; curr = curr.get.next }
|
||||
var current = head
|
||||
while(current.isDefined){ i += 1; curr = curr.get.next }
|
||||
return i
|
||||
}
|
||||
</code></pre>
|
||||
|
@ -99,43 +101,59 @@ textbook: "Ch. 7"
|
|||
<p class="fragment"><b>Complexity: </b> $O(1)$</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">mutable.List[T] : mutable.Seq[T]</h4>
|
||||
|
||||
<p><tt>apply(2)</tt>.</p>
|
||||
|
||||
<svg data-src="graphics/09b/linked-list-apply.svg"/>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">mutable.List[T] : mutable.Seq[T]</h4>
|
||||
|
||||
<p>Implementing <tt>apply</tt>.</p>
|
||||
|
||||
<pre class="fragment"><code class="scala">
|
||||
<pre><code class="scala">
|
||||
def apply(idx: Int): T =
|
||||
{
|
||||
var i = 0
|
||||
var curr = head
|
||||
while(i < idx){
|
||||
if(curr.isEmpty) { throw IndexOutOfBoundsException(idx) }
|
||||
i += 1; curr = curr.get.next
|
||||
var current = head
|
||||
for(i <- 0 until idx){
|
||||
if(current.isEmpty) { throw IndexOutOfBoundsException(idx) }
|
||||
current = current.get.next
|
||||
}
|
||||
if(curr.isEmpty) { throw IndexOutOfBoundsException(idx) }
|
||||
return curr
|
||||
if(current.isEmpty) { throw IndexOutOfBoundsException(idx) }
|
||||
return current
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<p class="fragment"><b>Complexity: </b> $O(n)$ <span class="fragment">(or $\Theta(\texttt{idx})$)</span></p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">mutable.List[T] : mutable.Seq[T]</h4>
|
||||
|
||||
<p><tt>insert(1, "D")</tt>.</p>
|
||||
|
||||
<svg data-src="graphics/09b/linked-list-insert.svg"/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">mutable.List[T] : mutable.Seq[T]</h4>
|
||||
|
||||
<p>Implementing <tt>insert</tt>.</p>
|
||||
|
||||
<pre class="fragment"><code class="scala">
|
||||
<pre style="transform: scale(0.8); margin-top: -50px; margin-bottom: -50px;"><code class="scala">
|
||||
def insert(idx: Int, value: T): Unit =
|
||||
{
|
||||
if(idx == 0){
|
||||
head = Some( new SinglyLinkedListNode(value, head) )
|
||||
} else {
|
||||
var i = 1; var curr = head
|
||||
while(i < idx){
|
||||
var current = head
|
||||
for(i <- 0 until idx){
|
||||
if(curr.isEmpty) { throw IndexOutOfBoundsException(idx) }
|
||||
i += 1; curr = curr.get.next
|
||||
curr = curr.get.next
|
||||
}
|
||||
curr.next = Some( new SinglyLinkedListNode(value, curr.next) )
|
||||
}
|
||||
|
@ -146,6 +164,10 @@ textbook: "Ch. 7"
|
|||
<p class="fragment"><b>Complexity: </b> $O(n)$ <span class="fragment">(or $\Theta(\texttt{idx})$)</span></p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p>Let's use <tt>apply()</tt></p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">mutable.List[T] : mutable.Seq[T]</h4>
|
||||
|
||||
|
@ -153,7 +175,7 @@ textbook: "Ch. 7"
|
|||
def sum(list: List[Int]): Unit =
|
||||
{
|
||||
val total: Int = 0
|
||||
for(i <- 0 until list.size){ total += list(i) }
|
||||
for(i <- 0 until list.length){ total += list(i) }
|
||||
return total
|
||||
}
|
||||
</code></pre>
|
||||
|
@ -185,10 +207,10 @@ textbook: "Ch. 7"
|
|||
def sum(list: List[Int]): Unit =
|
||||
{
|
||||
val total: Int = 0
|
||||
val curr = list.head
|
||||
while(curr.isDefined){
|
||||
total += curr.get.value
|
||||
curr = curr.get.next
|
||||
val current = list.head
|
||||
while(current.isDefined){
|
||||
total += current.get.value
|
||||
current = current.get.next
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
@ -219,7 +241,6 @@ textbook: "Ch. 7"
|
|||
<section>
|
||||
<h4 class="slide_title">Iterator[T]</h4>
|
||||
|
||||
<p>(Sort of) a "reference" to a collection element.</p>
|
||||
<dl>
|
||||
<dt><tt>hasNext: Boolean</tt></dt>
|
||||
<dd>Returns <tt>true</tt> if there are more items to retrieve.</dd>
|
||||
|
@ -229,19 +250,29 @@ textbook: "Ch. 7"
|
|||
</dl>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p>An iterator is:
|
||||
<ul>
|
||||
<li>A reference to an element of the collection</li>
|
||||
<li>A way to get to the next<sup class="fragment" data-fragment-index=1 style="font-size: 50%">1</sup> element of the collection.</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p class="fragment" data-fragment-index=1>1: For some definition of next.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">ListIterator[T] : Iterator[T]</h4>
|
||||
|
||||
<pre><code class="scala">
|
||||
class ListIterator[T](
|
||||
var curr: Option[SinglyLinkedListNode[T]]
|
||||
var current: Option[SinglyLinkedListNode[T]]
|
||||
)
|
||||
{
|
||||
def hasNext: Boolean = curr.isDefined
|
||||
def hasNext: Boolean = current.isDefined
|
||||
def next: T =
|
||||
{
|
||||
val ret = curr.get.value
|
||||
curr = curr.get.next
|
||||
val ret = current.get.value
|
||||
current = current.get.next
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
@ -250,14 +281,24 @@ textbook: "Ch. 7"
|
|||
|
||||
<section>
|
||||
<p>... back to LinkedLists</p>
|
||||
|
||||
<p class="fragment">How about positional operations:<br><tt style="font-size: 80%;">insertAfter(pos: SinglyLinkedListNode[T], value: T)</tt></p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">mutable.List[T] : mutable.Seq[T]</h4>
|
||||
|
||||
<p>How would you implement a positional <tt>insertAfter</tt>?</p>
|
||||
<p><tt>insertAfter(pos, "D")</tt></p>
|
||||
|
||||
<pre class="fragment"><code class="scala">
|
||||
<svg data-src="graphics/09b/linked-list-insertPositional.svg"/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h4 class="slide_title">mutable.List[T] : mutable.Seq[T]</h4>
|
||||
|
||||
<p>Implementing a positional <tt>insertAfter</tt></p>
|
||||
|
||||
<pre><code class="scala">
|
||||
def insertAfter(pos: SinglyLinkedListNode[T], value: T) =
|
||||
{
|
||||
pos.next = Some(
|
||||
|
@ -266,6 +307,11 @@ textbook: "Ch. 7"
|
|||
length += 1
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<p>What is the complexity?
|
||||
<span class="fragment">$\Theta(1)$</span>
|
||||
</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
@ -320,12 +366,10 @@ textbook: "Ch. 7"
|
|||
def insertAfter(pos: DoublyLinkedListNode[T], value: T) =
|
||||
{
|
||||
val newNode = new DoublyLinkedListNode(value, prev = Some(pos))
|
||||
if(pos.next.isDefined){
|
||||
pos.next.prev = Some(newNode)
|
||||
newNode.next = pos.next
|
||||
} else {
|
||||
last = newNode
|
||||
}
|
||||
if(pos.next.isDefined){ pos.next.prev = Some(newNode)
|
||||
newNode.next = pos.next }
|
||||
else { last = newNode
|
||||
newNode.next = None }
|
||||
pos.next = Some(newNode)
|
||||
length += 1
|
||||
}
|
||||
|
|
|
@ -0,0 +1,328 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="212.8959mm"
|
||||
height="69.458633mm"
|
||||
viewBox="0 0 212.8959 69.458634"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
sodipodi:docname="linked-list-apply.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.77246505"
|
||||
inkscape:cx="320.40285"
|
||||
inkscape:cy="102.91728"
|
||||
inkscape:window-width="1712"
|
||||
inkscape:window-height="926"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow1Lend"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Lend"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.8,0,0,-0.8,-10,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path8102" />
|
||||
</marker>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-7.4163405,-8.8008896)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="12.915709"
|
||||
id="text2970"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2968"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="12.915709">HEAD</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,14.432896 39.581944,28.857847"
|
||||
id="path5791" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="40.828339"
|
||||
y="34.47879"
|
||||
id="text6829"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan6827"
|
||||
style="stroke-width:0.264583"
|
||||
x="40.828339"
|
||||
y="34.47879">None</tspan></text>
|
||||
<g
|
||||
id="g1411">
|
||||
<g
|
||||
id="g1272"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect892"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect916"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1290"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1288"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">A</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1400">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1342"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1346"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1344"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1431"
|
||||
transform="translate(54.986871)">
|
||||
<g
|
||||
id="g1421"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1413"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1415"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1419"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1417"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">B</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1429">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1423"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1427"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1425"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1451"
|
||||
transform="translate(110.02021)">
|
||||
<g
|
||||
id="g1441"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1433"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1435"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1439"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1437"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">C</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1449">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1443"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1447"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1445"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1683"
|
||||
class="fragment fade-out"
|
||||
data-fragment-index="2">
|
||||
<g
|
||||
id="g1677"
|
||||
class="fragment"
|
||||
data-fragment-index="1">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046"
|
||||
id="text1670"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1668"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046">CURR</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="78.179596"
|
||||
id="tspan1685">i=0</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,66.085462 39.581944,51.660511"
|
||||
id="path1672" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1697"
|
||||
class="fragment fade-out"
|
||||
data-fragment-index="3"
|
||||
transform="translate(55.562501)">
|
||||
<g
|
||||
id="g1695"
|
||||
class="fragment"
|
||||
data-fragment-index="2">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046"
|
||||
id="text1691"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1687"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046">CURR</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="78.179596"
|
||||
id="tspan1689">i=1</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,66.085462 39.581944,51.660511"
|
||||
id="path1693" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1707"
|
||||
class="fragment"
|
||||
data-fragment-index="3"
|
||||
transform="translate(110.06667)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046"
|
||||
id="text1703"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1699"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046">CURR</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="78.179596"
|
||||
id="tspan1701">i=2</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,66.085462 39.581944,51.660511"
|
||||
id="path1705" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 12 KiB |
|
@ -2,12 +2,12 @@
|
|||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="210mm"
|
||||
height="297mm"
|
||||
viewBox="0 0 210 297"
|
||||
width="212.65889mm"
|
||||
height="42.601082mm"
|
||||
viewBox="0 0 212.65889 42.601082"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
sodipodi:docname="linked-list-example.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
|
@ -23,54 +23,39 @@
|
|||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.5449301"
|
||||
inkscape:cx="165.05601"
|
||||
inkscape:cy="104.85911"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1011"
|
||||
inkscape:window-x="1080"
|
||||
inkscape:window-y="352"
|
||||
inkscape:zoom="0.77246505"
|
||||
inkscape:cx="319.10829"
|
||||
inkscape:cy="102.91728"
|
||||
inkscape:window-width="1712"
|
||||
inkscape:window-height="926"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<marker
|
||||
style="overflow:visible;"
|
||||
style="overflow:visible"
|
||||
id="Arrow1Lend"
|
||||
refX="0.0"
|
||||
refY="0.0"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Lend"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="scale(0.8) rotate(180) translate(12.5,0)"
|
||||
style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt;"
|
||||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
|
||||
transform="matrix(-0.8,0,0,-0.8,-10,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path8102" />
|
||||
</marker>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g1272"
|
||||
transform="translate(40.594636,-4.3569573)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect892"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect916"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
</g>
|
||||
id="layer1"
|
||||
transform="translate(-7.6533629,-8.8008896)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
|
@ -97,5 +82,163 @@
|
|||
style="stroke-width:0.264583"
|
||||
x="40.828339"
|
||||
y="34.47879">None</tspan></text>
|
||||
<g
|
||||
id="g1411"
|
||||
class="fragment">
|
||||
<g
|
||||
id="g1272"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect892"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect916"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1290"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1288"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">A</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1400">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1342"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1346"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1344"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1431"
|
||||
transform="translate(54.986871)"
|
||||
class="fragment">
|
||||
<g
|
||||
id="g1421"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1413"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1415"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1419"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1417"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">B</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1429">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1423"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1427"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1425"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1451"
|
||||
transform="translate(110.02021)"
|
||||
class="fragment">
|
||||
<g
|
||||
id="g1441"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1433"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1435"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1439"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1437"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">C</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1449">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1443"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1447"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1445"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 9.0 KiB |
|
@ -0,0 +1,335 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="212.8959mm"
|
||||
height="87.409416mm"
|
||||
viewBox="0 0 212.8959 87.409417"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
sodipodi:docname="linked-list-insert.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.5449301"
|
||||
inkscape:cx="375.74516"
|
||||
inkscape:cy="142.07763"
|
||||
inkscape:window-width="1712"
|
||||
inkscape:window-height="926"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow1Lend"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Lend"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.8,0,0,-0.8,-10,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path8102" />
|
||||
</marker>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-7.4163405,-8.8008896)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="12.915709"
|
||||
id="text2970"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2968"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="12.915709">HEAD</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,14.432896 39.581944,28.857847"
|
||||
id="path5791" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="40.828339"
|
||||
y="34.47879"
|
||||
id="text6829"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan6827"
|
||||
style="stroke-width:0.264583"
|
||||
x="40.828339"
|
||||
y="34.47879">None</tspan></text>
|
||||
<g
|
||||
id="g1411">
|
||||
<g
|
||||
id="g1272"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect892"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect916"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1290"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1288"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">A</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1400">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1342"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1346"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1344"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1431"
|
||||
transform="translate(54.986871)">
|
||||
<g
|
||||
id="g1421"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1413"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1415"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1419"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1417"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">B</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1451"
|
||||
transform="translate(110.02021)">
|
||||
<g
|
||||
id="g1441"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1433"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1435"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1439"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1437"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">C</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1449">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1443"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1447"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1445"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1683"
|
||||
class="fragment fade-out"
|
||||
data-fragment-index="2">
|
||||
<g
|
||||
id="g1677"
|
||||
class="fragment"
|
||||
data-fragment-index="1">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046"
|
||||
id="text1670"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1668"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046">CURR</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="78.179596"
|
||||
id="tspan1685">i=0</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,66.085462 39.581944,51.660511"
|
||||
id="path1672" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1697"
|
||||
transform="translate(55.562501)" />
|
||||
<g
|
||||
id="g1695"
|
||||
class="fragment"
|
||||
data-fragment-index="2"
|
||||
transform="translate(55.562501)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046"
|
||||
id="text1691"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1687"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046">CURR</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="78.179596"
|
||||
id="tspan1689">i=1</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,66.085462 39.581944,51.660511"
|
||||
id="path1693" />
|
||||
</g>
|
||||
<g
|
||||
id="g2162"
|
||||
transform="translate(71.681957,44.808337)"
|
||||
class="fragment"
|
||||
data-fragment-index="3">
|
||||
<g
|
||||
id="g2152"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect2144"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect2146"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text2150"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2148"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">D</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 C 93.516144,38.925356 97.824482,27.99244 87.888461,24.737089 76.0606,20.861912 63.467083,13.095297 78.288519,7.0245534"
|
||||
id="path2154"
|
||||
sodipodi:nodetypes="csc" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 128.16444,40.182589 H 148.7924"
|
||||
id="path1423"
|
||||
sodipodi:nodetypes="cc"
|
||||
data-fragment-index="4"
|
||||
class="fragment fade-out" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="m 128.16444,40.182589 c 19.50723,2.058016 16.10457,19.742303 1.55278,21.128688 -19.73827,1.880514 -29.757951,4.159777 -17.62912,12.453482"
|
||||
id="path2172"
|
||||
sodipodi:nodetypes="csc"
|
||||
class="fragment"
|
||||
data-fragment-index="4" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,295 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="212.8959mm"
|
||||
height="87.409416mm"
|
||||
viewBox="0 0 212.8959 87.409417"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
sodipodi:docname="linked-list-insertPositional.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.5449301"
|
||||
inkscape:cx="375.74516"
|
||||
inkscape:cy="142.07763"
|
||||
inkscape:window-width="1712"
|
||||
inkscape:window-height="926"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Arrow1Lend"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto"
|
||||
inkscape:stockid="Arrow1Lend"
|
||||
inkscape:isstock="true">
|
||||
<path
|
||||
transform="matrix(-0.8,0,0,-0.8,-10,0)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 0,0 5,-5 -12.5,0 5,5 Z"
|
||||
id="path8102" />
|
||||
</marker>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-7.4163405,-8.8008896)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="12.915709"
|
||||
id="text2970"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2968"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="12.915709">HEAD</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,14.432896 39.581944,28.857847"
|
||||
id="path5791" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="40.828339"
|
||||
y="34.47879"
|
||||
id="text6829"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan6827"
|
||||
style="stroke-width:0.264583"
|
||||
x="40.828339"
|
||||
y="34.47879">None</tspan></text>
|
||||
<g
|
||||
id="g1411">
|
||||
<g
|
||||
id="g1272"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect892"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect916"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1290"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1288"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">A</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1400">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1342"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1346"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1344"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1431"
|
||||
transform="translate(54.986871)">
|
||||
<g
|
||||
id="g1421"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1413"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1415"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1419"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1417"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">B</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1451"
|
||||
transform="translate(110.02021)">
|
||||
<g
|
||||
id="g1441"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1433"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect1435"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text1439"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1437"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">C</tspan></text>
|
||||
</g>
|
||||
<g
|
||||
id="g1449">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 H 93.80553"
|
||||
id="path1443"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035"
|
||||
id="text1447"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1445"
|
||||
style="stroke-width:0.264583"
|
||||
x="95.866745"
|
||||
y="42.200035">None</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1695"
|
||||
transform="translate(55.562501)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:5.64444px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046"
|
||||
id="text1691"><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.264583"
|
||||
x="7.0993919"
|
||||
y="71.124046"
|
||||
id="tspan1689">POS</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 18.953983,66.085462 39.581944,51.660511"
|
||||
id="path1693" />
|
||||
</g>
|
||||
<g
|
||||
id="g2162"
|
||||
transform="translate(71.681957,44.808337)"
|
||||
class="fragment"
|
||||
data-fragment-index="1">
|
||||
<g
|
||||
id="g2152"
|
||||
transform="translate(4.0749707,2.8600052)">
|
||||
<rect
|
||||
style="fill:#99c1f1;stroke:#1c71d8;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect2144"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="36.232899"
|
||||
y="26.603203" />
|
||||
<rect
|
||||
style="fill:#ffa348;stroke:#e66100;stroke-width:1;stroke-linejoin:round;stroke-dashoffset:26.1543"
|
||||
id="rect2146"
|
||||
width="21.438763"
|
||||
height="21.438763"
|
||||
x="57.671658"
|
||||
y="26.603203" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.7856px;font-family:sans-serif;-inkscape-font-specification:sans-serif;fill:#000000;stroke:none;stroke-width:0;stroke-dasharray:none"
|
||||
x="42.391689"
|
||||
y="41.618458"
|
||||
id="text2150"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2148"
|
||||
style="font-weight:bold;stroke-width:0"
|
||||
x="42.391689"
|
||||
y="41.618458">D</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 73.177569,40.182589 C 93.516144,38.925356 97.824482,27.99244 87.888461,24.737089 76.0606,20.861912 63.467083,13.095297 78.288519,7.0245534"
|
||||
id="path2154"
|
||||
sodipodi:nodetypes="csc" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="M 128.16444,40.182589 H 148.7924"
|
||||
id="path1423"
|
||||
sodipodi:nodetypes="cc"
|
||||
data-fragment-index="2"
|
||||
class="fragment fade-out" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
||||
d="m 128.16444,40.182589 c 19.50723,2.058016 16.10457,19.742303 1.55278,21.128688 -19.73827,1.880514 -29.757951,4.159777 -17.62912,12.453482"
|
||||
id="path2172"
|
||||
sodipodi:nodetypes="csc"
|
||||
class="fragment"
|
||||
data-fragment-index="2" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue