mirror of
https://github.com/lavafroth/lavafroth.github.io.git
synced 2026-05-30 19:41:15 -03:00
deploy: 347281a3bb
This commit is contained in:
@@ -8,7 +8,7 @@ Consider an undirected graph with 5 vertices (V0,V1,V2,V3,V4)(V_0, V_1, V_2, V_3
|
||||
in Dijkstra’s algorithm (starting from V0V_0), the current tentative distances are:
|
||||
dist={V0:0,V1:5,V2:3,V3:8,V4:10}dist = \{V_0:0, V_1:5, V_2:3, V_3:8, V_4:10\}. And the processed set is: {V0:True,V1:False,V2:False,V3:False,V4:False}\{V_0:True,
|
||||
V_1:False, V_2:False, V_3:False, V_4:False\}. Assuming the next step is to select an unvisited
|
||||
vertex to mark as processed, which vertex will be chosen?'><meta name=author content><link rel="preload stylesheet" as=style href=https://lavafroth.is-a.dev/app.min.css><link rel=preload as=image href=../header.svg><link as=font href=https://lavafroth.is-a.dev/latinmodern-math.otf><link rel=preload as=image href=https://lavafroth.is-a.dev/github.svg><link rel=preload as=image href=https://lavafroth.is-a.dev/about.svg><link rel=preload as=image href=https://lavafroth.is-a.dev/art.svg><link rel=preload as=image href=https://lavafroth.is-a.dev/rss.svg><link rel=icon href=https://lavafroth.is-a.dev/favicon.png><link rel=blog-icon href=https://lavafroth.is-a.dev/icon.png></head><body><header><a class=site-name href=https://lavafroth.is-a.dev/><svg viewBox="0 0 8790 2080"><path d="M80 1935V465h216v1270h286v2e2zm853 0 222-1470h264l222 1470h-210l-40-3e2h-208l-40 3e2zm280-528h148l-62-494-6-78h-12l-6 78zm1025 528L2014 465h210l108 868 8 142h12l8-142 108-868h210l-224 1470zm813 0 222-1470h264l222 1470h-210l-40-3e2h-208l-40 3e2zm280-528h148l-62-494-6-78h-12l-6 78zm851 528V465h514v222h-298v386h2e2v222h-2e2v640zm910 0V465h216q194 0 286 108 92 107 92 316 0 124-43 215-44 90-106 132l147 699h-216l-122-620h-38v620zm216-820q60 0 95-26 35-27 50-76t15-116q0-105-34-161-35-57-126-57zm1084 836q-90 0-154-42-65-42-99-114-35-72-35-162V767q0-91 35-162 34-72 99-114 64-42 154-42t155 42q64 42 99 114 34 72 34 162v866q0 90-34 162-35 72-99 114-65 42-155 42zm0-210q40 0 56-33 16-34 16-75V767q0-41-17-74-17-34-55-34-37 0-54 34-18 33-18 74v866q0 41 17 75 17 33 55 33zm890 194V687h-204V465h624v222h-204v1248zm828 0V465h216v608h168V465h216v1470h-216v-640h-168v640z"/></svg></a><nav><a style=--url:url(./github.svg) href=https://github.com/lavafroth aria-label=github target=_blank></a><a href=../about/ aria-label=about style=--url:url(./about.svg)></a><a href=../art/ aria-label=art style=--url:url(./art.svg)></a><a href=../index.xml aria-label=rss style=--url:url(./rss.svg)></a><nav></header><main><hgroup data-pagefind-body><p data-pagefind-ignore><time>Oct 28, 2025 | 9 minutes read</time></p><h1 data-pagefind-meta=title>secret note jfgp3d7rrx0</h1></hgroup><section class=post-content data-pagefind-body><p>There will be an explanation for non-trivial questions.</p><h1 id=activity-1>Activity 1</h1><h2 id=1>1</h2><p>Dijkstra’s algorithm guarantees finding the shortest path from a single source to all other vertices under which of the following conditions?</p><p><strong>Answer:</strong> All edge weights must be non-negative.</p><h2 id=2>2</h2><p>Consider an undirected graph with 5 vertices <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><msub><mi>V</mi><mn>0</mn></msub><mo separator="true">,</mo><msub><mi>V</mi><mn>1</mn></msub><mo separator="true">,</mo><msub><mi>V</mi><mn>2</mn></msub><mo separator="true">,</mo><msub><mi>V</mi><mn>3</mn></msub><mo separator="true">,</mo><msub><mi>V</mi><mn>4</mn></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(V_0, V_1, V_2, V_3, V_4)</annotation></semantics></math></span>. At a certain point
|
||||
vertex to mark as processed, which vertex will be chosen?'><meta name=author content><link rel="preload stylesheet" as=style href=https://lavafroth.is-a.dev/app.min.css><link rel=preload as=image href=../header.svg><link as=font href=https://lavafroth.is-a.dev/latinmodern-math.otf><link rel=preload as=image href=https://lavafroth.is-a.dev/github.svg><link rel=preload as=image href=https://lavafroth.is-a.dev/about.svg><link rel=preload as=image href=https://lavafroth.is-a.dev/art.svg><link rel=preload as=image href=https://lavafroth.is-a.dev/rss.svg><link rel=icon href=https://lavafroth.is-a.dev/favicon.png><link rel=blog-icon href=https://lavafroth.is-a.dev/icon.png></head><body><header><a class=site-name href=https://lavafroth.is-a.dev/><svg viewBox="0 0 8790 2080"><path d="M80 1935V465h216v1270h286v2e2zm853 0 222-1470h264l222 1470h-210l-40-3e2h-208l-40 3e2zm280-528h148l-62-494-6-78h-12l-6 78zm1025 528L2014 465h210l108 868 8 142h12l8-142 108-868h210l-224 1470zm813 0 222-1470h264l222 1470h-210l-40-3e2h-208l-40 3e2zm280-528h148l-62-494-6-78h-12l-6 78zm851 528V465h514v222h-298v386h2e2v222h-2e2v640zm910 0V465h216q194 0 286 108 92 107 92 316 0 124-43 215-44 90-106 132l147 699h-216l-122-620h-38v620zm216-820q60 0 95-26 35-27 50-76t15-116q0-105-34-161-35-57-126-57zm1084 836q-90 0-154-42-65-42-99-114-35-72-35-162V767q0-91 35-162 34-72 99-114 64-42 154-42t155 42q64 42 99 114 34 72 34 162v866q0 90-34 162-35 72-99 114-65 42-155 42zm0-210q40 0 56-33 16-34 16-75V767q0-41-17-74-17-34-55-34-37 0-54 34-18 33-18 74v866q0 41 17 75 17 33 55 33zm890 194V687h-204V465h624v222h-204v1248zm828 0V465h216v608h168V465h216v1470h-216v-640h-168v640z"/></svg></a><nav><a style=--url:url(./github.svg) href=https://github.com/lavafroth aria-label=github target=_blank></a><a href=../about/ aria-label=about style=--url:url(./about.svg)></a><a href=../art/ aria-label=art style=--url:url(./art.svg)></a><a href=../index.xml aria-label=rss style=--url:url(./rss.svg)></a><nav></header><main><hgroup data-pagefind-body><p data-pagefind-ignore><time>Oct 28, 2025 | 13 minutes read</time></p><h1 data-pagefind-meta=title>secret note jfgp3d7rrx0</h1></hgroup><section class=post-content data-pagefind-body><p>There will be an explanation for non-trivial questions.</p><h1 id=activity-1>Activity 1</h1><h2 id=1>1</h2><p>Dijkstra’s algorithm guarantees finding the shortest path from a single source to all other vertices under which of the following conditions?</p><p><strong>Answer:</strong> All edge weights must be non-negative.</p><h2 id=2>2</h2><p>Consider an undirected graph with 5 vertices <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><msub><mi>V</mi><mn>0</mn></msub><mo separator="true">,</mo><msub><mi>V</mi><mn>1</mn></msub><mo separator="true">,</mo><msub><mi>V</mi><mn>2</mn></msub><mo separator="true">,</mo><msub><mi>V</mi><mn>3</mn></msub><mo separator="true">,</mo><msub><mi>V</mi><mn>4</mn></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(V_0, V_1, V_2, V_3, V_4)</annotation></semantics></math></span>. At a certain point
|
||||
in Dijkstra’s algorithm (starting from <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>V</mi><mn>0</mn></msub></mrow><annotation encoding="application/x-tex">V_0</annotation></semantics></math></span>), the current tentative distances are:
|
||||
<span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>d</mi><mi>i</mi><mi>s</mi><mi>t</mi><mo>=</mo><mo stretchy="false">{</mo><msub><mi>V</mi><mn>0</mn></msub><mo>:</mo><mn>0</mn><mo separator="true">,</mo><msub><mi>V</mi><mn>1</mn></msub><mo>:</mo><mn>5</mn><mo separator="true">,</mo><msub><mi>V</mi><mn>2</mn></msub><mo>:</mo><mn>3</mn><mo separator="true">,</mo><msub><mi>V</mi><mn>3</mn></msub><mo>:</mo><mn>8</mn><mo separator="true">,</mo><msub><mi>V</mi><mn>4</mn></msub><mo>:</mo><mn>10</mn><mo stretchy="false">}</mo></mrow><annotation encoding="application/x-tex">dist = \{V_0:0, V_1:5, V_2:3, V_3:8, V_4:10\}</annotation></semantics></math></span>. And the processed set is: <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">{</mo><msub><mi>V</mi><mn>0</mn></msub><mo>:</mo><mi>T</mi><mi>r</mi><mi>u</mi><mi>e</mi><mo separator="true">,</mo><msub><mi>V</mi><mn>1</mn></msub><mo>:</mo><mi>F</mi><mi>a</mi><mi>l</mi><mi>s</mi><mi>e</mi><mo separator="true">,</mo><msub><mi>V</mi><mn>2</mn></msub><mo>:</mo><mi>F</mi><mi>a</mi><mi>l</mi><mi>s</mi><mi>e</mi><mo separator="true">,</mo><msub><mi>V</mi><mn>3</mn></msub><mo>:</mo><mi>F</mi><mi>a</mi><mi>l</mi><mi>s</mi><mi>e</mi><mo separator="true">,</mo><msub><mi>V</mi><mn>4</mn></msub><mo>:</mo><mi>F</mi><mi>a</mi><mi>l</mi><mi>s</mi><mi>e</mi><mo stretchy="false">}</mo></mrow><annotation encoding="application/x-tex">\{V_0:True,
|
||||
V_1:False, V_2:False, V_3:False, V_4:False\}</annotation></semantics></math></span>. Assuming the next step is to select an unvisited
|
||||
@@ -80,4 +80,33 @@ there exists a negative cycle in the graph.</p><div class=highlight><pre tabinde
|
||||
</span></span><span style=display:flex><span> parent[v] <span style=color:#f92672>=</span> u
|
||||
</span></span><span style=display:flex><span>
|
||||
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#66d9ef>False</span>
|
||||
</span></span></code></pre></div><h1 id=ga>GA</h1></section><footer class=post-tags data-pagefind-meta=tags></footer></main><footer class=footer><p>© 2025 <a href=https://lavafroth.is-a.dev/>lavafroth</a></p><p><a href=https://github.com/lavafroth/lavafroth.github.io/issues/new/choose>Report an issue</a></p><p><a href=https://github.com/lavafroth/lavafroth.github.io/discussions/>Discuss</a></p><p><a href=https://lavafroth.is-a.dev/privacy>Privacy</a></p><p><a href=https://creativecommons.org/licenses/by-sa/4.0/legalcode>License</a></p></footer></body></html>
|
||||
</span></span></code></pre></div><h1 id=ga>GA</h1><h2 id=1-6>1</h2><p>At each step of Dijkstra’s algorithm, after a vertex has been processed, how does the algorithm determine which unvisited vertex to process next?</p><p>Answer: It picks the unvisited vertex that has the smallest current shortest distance from the source.</p><h2 id=2-6>2</h2><p>Which of the following statements correctly describes how the Bellman-Ford algorithm detects the presence of a negative cycle reachable from the source? Consider that V is the number of vertices in the graph.</p><p>Answer: If, during a Vth pass over all edges, any distance value can still be improved (i.e., an edge relaxation occurs).</p><h2 id=3-6>3</h2><p>A graph has 4 vertices (V1, V2, V3, V4) and the following edges:</p><ul><li>V1 → V2 (weight = 2)</li><li>V2 → V3 (weight = -3)</li><li>V3 → V1 (weight = 0)</li><li>V1 → V4 (weight = 5)</li></ul><p>If Bellman-Ford starts from V1, after running the algorithm for all necessary passes, how many vertices will have their shortest distance updated in the final (4-th) pass used for negative cycle detection?</p><p>Answer: 3</p><h2 id=4-5>4</h2><p>Consider any connected graph with 4 vertices and 6 edges, where all edge weights are distinct. In such a graph, the three edges with the smallest weights will always be part of its Minimum Spanning Tree (MST).</p><p>Answer: False</p><h2 id=5-5>5</h2><p>A graph can have a unique Minimum Spanning Tree (MST) only if all its edge weights are distinct</p><p>Answer: True</p><h2 id=6-5>6</h2><p>Suppose we run Prim’s algorithm and Kruskal’s algorithm on a graph G and these two algorithms
|
||||
produce minimum-cost spanning trees <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>T</mi><mi>P</mi></msub></mrow><annotation encoding="application/x-tex">T_P</annotation></semantics></math></span> and <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>T</mi><mi>K</mi></msub></mrow><annotation encoding="application/x-tex">T_K</annotation></semantics></math></span>, respectively.</p><p>(I) <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>T</mi><mi>P</mi></msub></mrow><annotation encoding="application/x-tex">T_P</annotation></semantics></math></span> may be different from <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>T</mi><mi>K</mi></msub></mrow><annotation encoding="application/x-tex">T_K</annotation></semantics></math></span> if some pair of edges in G have the same weight.</p><p>(II) <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>T</mi><mi>P</mi></msub></mrow><annotation encoding="application/x-tex">T_P</annotation></semantics></math></span> is always the same as <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>T</mi><mi>K</mi></msub></mrow><annotation encoding="application/x-tex">T_K</annotation></semantics></math></span> if all edges in G have distinct weights.</p><p>Answer: Both (I) and (II) are correct.</p><h2 id=7>7</h2><p>Which one of the following can be the sequence of edges added, in that order, to create a minimum spanning tree using Kruskal’s algorithm?</p><p>Answers:</p><ol><li>(a,b) (d,f) (b,f) (d,c) (d,e)</li><li>(a,b) (d,f) (d,c) (b,f) (d,e)</li><li>(d,f) (a,b) (d,c) (b,f) (d,e)</li></ol><ol start=5><li>(d,f) (a,b) (b,f) (d,c) (d,e)</li></ol><h2 id=8>8</h2><p>Consider the given weighted adjacency matrix <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi></mrow><annotation encoding="application/x-tex">w</annotation></semantics></math></span> for a complete undirected graph with vertex
|
||||
set <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">{</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mo separator="true">,</mo><mn>2</mn><mo separator="true">,</mo><mn>3</mn><mo separator="true">,</mo><mn>4</mn><mo stretchy="false">}</mo></mrow><annotation encoding="application/x-tex">\{0, 1, 2, 3, 4\}</annotation></semantics></math></span>. Where <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi><mo stretchy="false">[</mo><mi>i</mi><mo stretchy="false">]</mo><mo stretchy="false">[</mo><mi>j</mi><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">w[i][j]</annotation></semantics></math></span>, <span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo mathvariant="normal">≠</mo><mi>j</mi></mrow><annotation encoding="application/x-tex">i \neq j</annotation></semantics></math></span> in the matrix is the weight of the edge
|
||||
<span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(i,j)</annotation></semantics></math></span>.</p><span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>w</mi><mo>=</mo><mrow><mo fence="true">(</mo><mtable rowspacing="0.16em" columnalign="center center center center center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>8</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>12</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>9</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>8</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>12</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>7</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>3</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>7</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>2</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>9</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>3</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>2</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd></mtr></mtable><mo fence="true">)</mo></mrow></mrow><annotation encoding="application/x-tex">w = \begin{pmatrix}
|
||||
0 & 1 & 8 & 1 & 4 \\
|
||||
1 & 0 & 12 & 4 & 9 \\
|
||||
8 & 12 & 0 & 7 & 3 \\
|
||||
1 & 4 & 7 & 0 & 2 \\
|
||||
4 & 9 & 3 & 2 & 0
|
||||
\end{pmatrix}</annotation></semantics></math></span><p>What is the weight of the minimum spanning tree for the given graph?</p><p>Answer: 7</p><h2 id=9>9</h2><p>Which of the following statement(s) is/are true about the spanning tree of a connected graph?</p><p>Answers:</p><ul><li>A spanning tree is a connected acyclic graph.</li><li>A spanning tree for an n vertex graph has exactly n-1 edges.</li><li>Adding an edge to a spanning tree must create a cycle.</li><li>In a spanning tree, every pair of nodes is connected by a unique path</li></ul><h2 id=10>10</h2><p>Consider the following weighted adjacency list WList for a directed and connected graph. What will be the path weight of the shortest path from 1 to 3?</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span>WList <span style=color:#f92672>=</span> {
|
||||
</span></span><span style=display:flex><span> <span style=color:#75715e>#source: [(destination, weight),...]</span>
|
||||
</span></span><span style=display:flex><span> <span style=color:#ae81ff>1</span>: [(<span style=color:#ae81ff>2</span>, <span style=color:#ae81ff>10</span>), (<span style=color:#ae81ff>8</span>, <span style=color:#ae81ff>8</span>)],
|
||||
</span></span><span style=display:flex><span> <span style=color:#ae81ff>2</span>: [(<span style=color:#ae81ff>6</span>, <span style=color:#ae81ff>2</span>)],
|
||||
</span></span><span style=display:flex><span> <span style=color:#ae81ff>3</span>: [(<span style=color:#ae81ff>2</span>, <span style=color:#ae81ff>1</span>), (<span style=color:#ae81ff>4</span>, <span style=color:#ae81ff>1</span>)],
|
||||
</span></span><span style=display:flex><span> <span style=color:#ae81ff>4</span>: [(<span style=color:#ae81ff>5</span>, <span style=color:#ae81ff>3</span>)],
|
||||
</span></span><span style=display:flex><span> <span style=color:#ae81ff>5</span>: [(<span style=color:#ae81ff>6</span>, <span style=color:#f92672>-</span><span style=color:#ae81ff>1</span>)],
|
||||
</span></span><span style=display:flex><span> <span style=color:#ae81ff>6</span>: [(<span style=color:#ae81ff>3</span>, <span style=color:#f92672>-</span><span style=color:#ae81ff>2</span>)],
|
||||
</span></span><span style=display:flex><span> <span style=color:#ae81ff>7</span>: [(<span style=color:#ae81ff>2</span>, <span style=color:#f92672>-</span><span style=color:#ae81ff>4</span>), (<span style=color:#ae81ff>6</span>, <span style=color:#f92672>-</span><span style=color:#ae81ff>1</span>)],
|
||||
</span></span><span style=display:flex><span> <span style=color:#ae81ff>8</span>: [(<span style=color:#ae81ff>7</span>, <span style=color:#ae81ff>1</span>)]
|
||||
</span></span><span style=display:flex><span>}
|
||||
</span></span></code></pre></div><p>Answer: 5</p><h2 id=11>11</h2><p>Consider a complete undirected graph with vertex set {0, 1, 2, 3, 4}. Every entry W[i][j] where i≠j in the matrix W below is the weight of the edge from vertex i to vertex j.</p><span class=katex><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>w</mi><mo>=</mo><mrow><mo fence="true">(</mo><mtable rowspacing="0.16em" columnalign="center center center center center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>8</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>12</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>9</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>8</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>12</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>7</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>3</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>7</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>2</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>9</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>3</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>2</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>0</mn></mstyle></mtd></mtr></mtable><mo fence="true">)</mo></mrow></mrow><annotation encoding="application/x-tex">w = \begin{pmatrix}
|
||||
0 & 1 & 8 & 1 & 4 \\
|
||||
1 & 0 & 12 & 4 & 9 \\
|
||||
8 & 12 & 0 & 7 & 3 \\
|
||||
1 & 4 & 7 & 0 & 2 \\
|
||||
4 & 9 & 3 & 2 & 0
|
||||
\end{pmatrix}</annotation></semantics></math></span><p>Answer: 4</p><h2 id=12>12</h2><p>In the given graph, if we try to find the shortest path from node a to all other nodes using Dijkstra’s algorithm, in what order do the nodes get included in the visited set?</p><p>Answer: a e d c b g f h</p><h2 id=13>13</h2><p>Consider the given graph. Which of the following is the correct sequence of edges added to the minimum spanning tree when Prim’s algorithm is applied on this graph with 5 as the source vertex?</p><p>Answer: [(5,1),(1,2),(2,3),(3,4)]</p><h2 id=14>14</h2><p>In the context of the Floyd-Warshall algorithm, what does it mean if the distance matrix has a negative value in its diagonal?</p><p>Answer: The graph has a negative-weight cycle.</p><h2 id=15>15</h2><p>Consider the graph G given. Let
|
||||
α denote the number of minimum spanning trees of G and
|
||||
β denote the weight of such a minimum spanning tree. The value of
|
||||
α+β is</p><p>Answer: 14</p></section><footer class=post-tags data-pagefind-meta=tags></footer></main><footer class=footer><p>© 2025 <a href=https://lavafroth.is-a.dev/>lavafroth</a></p><p><a href=https://github.com/lavafroth/lavafroth.github.io/issues/new/choose>Report an issue</a></p><p><a href=https://github.com/lavafroth/lavafroth.github.io/discussions/>Discuss</a></p><p><a href=https://lavafroth.is-a.dev/privacy>Privacy</a></p><p><a href=https://creativecommons.org/licenses/by-sa/4.0/legalcode>License</a></p></footer></body></html>
|
||||
Binary file not shown.
BIN
pagefind/fragment/en-us_e1c4bd5.pf_fragment
Normal file
BIN
pagefind/fragment/en-us_e1c4bd5.pf_fragment
Normal file
Binary file not shown.
BIN
pagefind/index/en-us_2668ba2.pf_index
Normal file
BIN
pagefind/index/en-us_2668ba2.pf_index
Normal file
Binary file not shown.
Binary file not shown.
BIN
pagefind/index/en-us_3be3a5e.pf_index
Normal file
BIN
pagefind/index/en-us_3be3a5e.pf_index
Normal file
Binary file not shown.
BIN
pagefind/index/en-us_3db2f6a.pf_index
Normal file
BIN
pagefind/index/en-us_3db2f6a.pf_index
Normal file
Binary file not shown.
Binary file not shown.
BIN
pagefind/index/en-us_651b4c6.pf_index
Normal file
BIN
pagefind/index/en-us_651b4c6.pf_index
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
pagefind/index/en-us_97d6256.pf_index
Normal file
BIN
pagefind/index/en-us_97d6256.pf_index
Normal file
Binary file not shown.
Binary file not shown.
BIN
pagefind/index/en-us_dc13e6f.pf_index
Normal file
BIN
pagefind/index/en-us_dc13e6f.pf_index
Normal file
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
{"version":"1.0.3","languages":{"en-us":{"hash":"en-us_fc2e4d403cd58","wasm":"en-us","page_count":56}}}
|
||||
{"version":"1.0.3","languages":{"en-us":{"hash":"en-us_c11118dc9fbec","wasm":"en-us","page_count":56}}}
|
||||
BIN
pagefind/pagefind.en-us_c11118dc9fbec.pf_meta
Normal file
BIN
pagefind/pagefind.en-us_c11118dc9fbec.pf_meta
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user