<style>
.update{
color: #4CAF50;
}
td {
text-align: center;
}
body{
background: url(https://i.imgur.com/hKtpYnf.gif);
}
#case2 table{
position: absolute;
left: -145px
}
.post {
padding: 1rem;
}
.child {
border: 1px solid none;
padding: 1rem;
width: fixed;
float:left;
}
.child img{
height:267px;
}
}
</style>
# Data Structures Programming Project #2
###### tags: `Data Structure`
---
<!-- .slide: data-transition="slide-in fade-out"-->
## Case 1
|s|1|2|3|4|5|6|7|8|9|10|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|7|2|9|10|-1|-1|-1|8|1|3|d|-1|
|4|6|1|2|5|3|d|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same;rank1->s->1->2->3->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->4->5->6[style=invis]}
node[color=black;fontcolor=white]
{rank=same;rank3->7->8->9->10[style=invis]}
subgraph new{
s->4->5->3->2->1->6->d[style=dashed]
}
subgraph cur{
s->7->8->1->2->9->3->10->d[color=blue]
}
rank1->rank2->rank3[color=white]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
|s|1|2|3|4|5|6|7|8|9|10|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|7|2|9|10|-1|-1|-1|8|1|3|d|-1|
|7|2|9|10|<div class="update">5</div>|<div class="update">3</div>|<div class="update">d</div>|8|1|3|d|-1|
|4|6|1|2|5|3|d|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same;rank1->s->1->2->3->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->4->5->6[style=invis]}
node[color=black;fontcolor=white]
{rank=same;rank3->7->8->9->10[style=invis]}
subgraph Upt{
edge[color=green]
4->5->3
6->d
}
subgraph new{
s->4[style=dashed]
3->2->1->6[style=dashed]
}
subgraph cur{
s->7->8->1->2->9->3->10->d[color=blue]
}
rank1->rank2->rank3[color=white]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
|s|1|2|3|4|5|6|7|8|9|10|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|7|2|9|10|-1|-1|-1|8|1|3|d|-1|
|7|2|9|10|5|3|d|8|1|3|d|-1|
|<div style="color:red">4</div>|2|9|10|5|3|d|8|1|3|d|-1|
|4|6|1|2|5|3|d|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same;rank1->s->1->2->3->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->4->5->6[style=invis]}
node[color=black;fontcolor=white]
{rank=same;rank3->7->8->9->10[style=invis]}
subgraph upt{
s->4[color=red]
}
subgraph new{
3->2->1->6[style=dashed]
}
subgraph cur{
edge[color=blue]
4->5->3
6->d
7->8->1->2->9->3->10->d
}
rank1->rank2->rank3[color=white]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
|s|1|2|3|4|5|6|7|8|9|10|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|7|2|9|10|-1|-1|-1|8|1|3|d|-1|
|7|2|9|10|5|3|d|8|1|3|d|-1|
|4|2|9|10|5|3|d|8|1|3|d|-1|
|4|<div class="update">6</div>|<div class="update">1</div>|10|5|3|d|8|1|3|d|-1|
|4|6|1|2|5|3|d|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same;rank1->s->1->2->3->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->4->5->6[style=invis]}
node[color=black;fontcolor=white]
{rank=same;rank3->7->8->9->10[style=invis]}
subgraph upt{
edge[color=green]
2->1->6
}
subgraph new{
3->2[style=dashed]
}
subgraph cur{
edge[color=blue]
s->4->5->3
6->d
7->8->1
9->3->10->d
}
rank1->rank2->rank3[color=white]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
|s|1|2|3|4|5|6|7|8|9|10|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|7|2|9|10|-1|-1|-1|8|1|3|d|-1|
|7|2|9|10|5|3|d|8|1|3|d|-1|
|4|2|9|10|5|3|d|8|1|3|d|-1|
|4|6|1|10|5|3|d|8|1|3|d|-1|
|4|6|1|<div style="color:red">2</div>|5|3|d|8|1|3|d|-1|
|4|6|1|2|5|3|d|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same;rank1->s->1->2->3->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->4->5->6[style=invis]}
node[color=black;fontcolor=white]
{rank=same;rank3->7->8->9->10[style=invis]}
subgraph upt{
edge[color=red]
3->2
}
subgraph new{
}
subgraph cur{
edge[color=blue]
2->1->6
s->4->5->3
6->d
7->8->1
9->3
10->d
}
rank1->rank2->rank3[color=white]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
|s|1|2|3|4|5|6|7|8|9|10|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|7|2|9|10|-1|-1|-1|8|1|3|d|-1|
|7|2|9|10|5|3|d|8|1|3|d|-1|
|4|2|9|10|5|3|d|8|1|3|d|-1|
|4|6|1|10|5|3|d|8|1|3|d|-1|
|4|6|1|2|5|3|d|8|1|3|d|-1|
|4|6|1|2|5|3|d|<div class="update">-1|<div class="update">-1|<div class="update">-1|<div class="update">-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same;rank1->s->1->2->3->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->4->5->6[style=invis]}
node[color=black;fontcolor=white]
{rank=same;rank3->7->8->9->10[style=invis]}
subgraph upt{
edge[color=red]
}
subgraph new{
}
subgraph cur{
edge[color=blue]
3->2
2->1->6
s->4->5->3
6->d
}
rank1->rank2->rank3[color=white]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
<div id="case2">
## Case 2
|s|1|2|3|4|5|6|7|8|9|10|11|12|13|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|9|11|12|13|d|-1|-1|-1|-1|10|1|2|3|4|-1|
|5|4|8|7|2|6|3|1|d|-1|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same; rank1->s->1->4->3->2->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->5->6->7->8[style=invis]}
node[color=black fontcolor=white]
{rank=same; rank3->9->10->11->12->13[style=invis]}
subgraph new{
edge[style=dashed]
s->5->6->3->7->1->4->2->8->d
}
subgraph cur{
edge[color=blue]
s->9->10->1->11->2->12->3->13->4->d
}
rank1->rank2->rank3[style=invis]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
<div id="case2">
|s|1|2|3|4|5|6|7|8|9|10|11|12|13|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|9|11|12|13|d|-1|-1|-1|-1|10|1|2|3|4|-1|
|9|11|12|13|d|<div class="update">6|<div class="update">3|<div class="update">1|<div class="update">d|10|1|2|3|4|-1|
|5|4|8|7|2|6|3|1|d|-1|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same; rank1->s->1->4->3->2->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->5->6->7->8[style=invis]}
node[color=black fontcolor=white]
{rank=same; rank3->9->10->11->12->13[style=invis]}
subgraph{
edge[color=green]
5->6->3
7->1
8->d
}
subgraph new{
edge[style=dashed]
s->5
3->7
1->4->2->8
}
subgraph cur{
edge[color=blue]
s->9->10->1->11->2->12->3->13->4->d
}
rank1->rank2->rank3[style=invis]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
<div id="case2">
|s|1|2|3|4|5|6|7|8|9|10|11|12|13|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|9|11|12|13|d|-1|-1|-1|-1|10|1|2|3|4|-1|
|9|11|12|13|d|6|3|1|d|10|1|2|3|4|-1|
|<div style="color:red">5|11|12|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|4|8|7|2|6|3|1|d|-1|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same; rank1->s->1->4->3->2->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->5->6->7->8[style=invis]}
node[color=black fontcolor=white]
{rank=same; rank3->9->10->11->12->13[style=invis]}
subgraph{
edge[color=red]
s->5
}
subgraph new{
edge[style=dashed]
3->7
1->4->2->8
}
subgraph cur{
edge[color=blue]
5->6->3
7->1
8->d
9->10->1->11->2->12->3->13->4->d
}
rank1->rank2->rank3[style=invis]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
<div id="case2">
|s|1|2|3|4|5|6|7|8|9|10|11|12|13|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|9|11|12|13|d|-1|-1|-1|-1|10|1|2|3|4|-1|
|9|11|12|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|11|12|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|<div class="update">4|<div class="update">8|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|4|8|7|2|6|3|1|d|-1|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same; rank1->s->1->4->3->2->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->5->6->7->8[style=invis]}
node[color=black fontcolor=white]
{rank=same; rank3->9->10->11->12->13[style=invis]}
subgraph{
edge[color=green]
1->4
2->8
}
subgraph new{
edge[style=dashed]
3->7
4->2
}
subgraph cur{
edge[color=blue]
s->5
5->6->3
7->1
8->d
9->10->1
11->2
12->3->13->4->d
}
rank1->rank2->rank3[style=invis]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
<div id="case2">
|s|1|2|3|4|5|6|7|8|9|10|11|12|13|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|9|11|12|13|d|-1|-1|-1|-1|10|1|2|3|4|-1|
|9|11|12|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|11|12|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|4|8|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|4|8|<div style="color:red;">7|<div style="color:red;">2|6|3|1|d|10|1|2|3|4|-1|
|5|4|8|7|2|6|3|1|d|-1|-1|-1|-1|-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same; rank1->s->1->4->3->2->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->5->6->7->8[style=invis]}
node[color=black fontcolor=white]
{rank=same; rank3->9->10->11->12->13[style=invis]}
subgraph{
edge[color=red]
3->7
4->2
}
subgraph new{
edge[style=dashed]
}
subgraph cur{
edge[color=blue]
1->4
2->8
s->5
5->6->3
7->1
8->d
9->10->1
11->2
12->3
13->4
}
rank1->rank2->rank3[style=invis]
}
```
---
<!-- .slide: data-transition="slide-in fade-out"-->
<div id="case2">
|s|1|2|3|4|5|6|7|8|9|10|11|12|13|d|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|9|11|12|13|d|-1|-1|-1|-1|10|1|2|3|4|-1|
|9|11|12|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|11|12|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|4|8|13|d|6|3|1|d|10|1|2|3|4|-1|
|5|4|8|7|2|6|3|1|d|10|1|2|3|4|-1|
|5|4|8|7|2|6|3|1|d|<div class="update">-1|<div class="update">-1|<div class="update">-1|<div class="update">-1|<div class="update">-1|-1|
----
<!-- .slide: data-transition="zoom-in convex-out" -->
```graphviz
digraph G{
rank1[style=invis label="" height=0.01 width=0.01]
rank2[style=invis label="" height=0.01 width=0.01]
rank3[style=invis label="" height=0.01 width=0.01]
node[shape=circle]
{rank=same; rank1->s->1->4->3->2->d[style=invis]}
node[style=filled]
node[color=red]
{rank=same; rank2->5->6->7->8[style=invis]}
node[color=black fontcolor=white]
{rank=same; rank3->9->10->11->12->13[style=invis]}
subgraph{
edge[color=red]
}
subgraph new{
edge[style=dashed]
}
subgraph cur{
edge[color=blue]
3->7
4->2
1->4
2->8
s->5
5->6->3
7->1
8->d
}
rank1->rank2->rank3[style=invis]
}
```
---
<!-- .slide: data-background="https://i.imgur.com/jdpnsnB.jpg" -->
### 歡迎參與 SITCON 2020
今年已經 delay 了
但明年絕對不能遲到
- ==[SITCON 2020 徵稿中](https://sitcon.org/2020/cfp)==
- ==[SITCON 2020 遠道而來票開放申請中](https://docs.google.com/forms/d/e/1FAIpQLSeQslRCOi6JpfSVTx6xpuDrzuETUUt6O767SJKUxq5qnX_4xw/formResponse)==
<div class="post">
<div class="child">

</div>
<div class="child">

</div>
</div>
---
## Case 3
|s|1|2|3|4|5|6|7|8|9|10|11|12|13|14|d|
|-|-|-|-|-|-|-|-|-|-|--|--|--|--|--|-|
|11|2|12|4|7|d|-1|13|-1|-1|-1|1|3|14|5|-1|
|1|6|10|7|d|9|3|8|5|2|4|-1|-1|-1|-1|-1|
```graphviz
digraph G{
node[shape=circle]
s 1 2 3 4 5 7 d
node[style=filled, color=red]
6 8 9 10
node[color=black, fontcolor=white]
12 13 14 11
s->11
11->1
1->2
2->12
12->3
3->4
4->7
7->13
13->14
14->5
5->d
}
```
## Case 3
|s|1|2|3|4|5|6|7|8|9|10|11|12|13|14|d|
|-|-|-|-|-|-|-|-|-|-|--|--|--|--|--|-|
|11|2|12|4|7|d|-1|13|-1|-1|-1|1|3|14|5|-1|
|11|2|12|4|7|d|3|13|5|2|4|1|3|14|5|-1|
|1|6|10|7|d|9|3|8|5|2|4|-1|-1|-1|-1|-1|
```graphviz
digraph G{
node[shape=circle]
s 1 2 3 4 5 7 d
node[style=filled, color=red]
6 8 9 10
node[color=black, fontcolor=white]
12 13 14 11
s->11
11->1
1->2
2->12
12->3
3->4
4->7
7->13
13->14
14->5
5->d
edge[color=green]
6->3
8->5
9->2
10->4
}
```
{"metaMigratedAt":"2023-06-15T00:43:00.502Z","metaMigratedFrom":"YAML","title":"Data Structures Programming Project","breaks":true,"contributors":"[{\"id\":\"d2027845-ecc1-4523-9733-b9f68ce9660f\",\"add\":25479,\"del\":9808}]"}