You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p><strong>b.</strong>Each insert step takes at most $O(\lg n)$, since we are doing it $n$ times, we get a bound on the runtime of $O(n\lg n)$.</p>
9811
+
<p><strong>b.</strong>It is very easy to find out that the $\text{MAX-HEAP-INSERT}$ operation for each iteration takes $\Theta(\log i)$ time, therefore the total time complexity is the sum of the individual complexities for $i$ from $2$ to $n$, which is : $\Theta(\log 2) + \Theta(\log 3) + \dots + \Theta(\log n) = \Theta(\log n!) $. By using Stirling's approximation, $\Theta (\log n!) \approx \Theta(n\log n)$, so the overall complexity is $\Theta(n\log n)$.</p>
<p>Use the substitution method to prove that the recurrence $T(n) = T(n - 1) + \Theta(n)$ has the solution $T(n) = \Theta(n^2)$, as claimed at the beginning of section 7.2.</p>
9945
9945
</blockquote>
9946
-
<p>We represent $\Theta(n)$ as $c_2n$ and we guess that $T(n) \le c_1n^2$,</p>
9946
+
<p><strong>Proof</strong></p>
9947
+
<p>We are given the recurrence</p>
9947
9948
<p>$$
9948
-
\begin{aligned}
9949
-
T(n) & = T(n - 1) + c_2n \\
9950
-
& \le c_1(n - 1)^2 + c_2n \\
9951
-
& = c_1n^2 - 2c_1n + c_1 + c_2n & (2c_1 > c_2, n \ge c_1 / (2c_1 - c_2)) \\
9952
-
& \le c_1n^2.
9953
-
\end{aligned}
9949
+
T(n) = T(n - 1) + \Theta(n),
9954
9950
$$</p>
9951
+
<p>and we aim to prove $T(n) = \Theta(n^2)$.</p>
9952
+
<p>By the definition of $\Theta(n)$, there exist constants $c_1$, $c_2$, and $n_0$ such that for all $n \ge n_0$,</p>
9953
+
<p>$$
9954
+
c_1 n \le f(n) \le c_2 n,
9955
+
$$</p>
9956
+
<p>where $f(n) = \Theta(n)$. Thus, the recurrence becomes</p>
9957
+
<p>$$
9958
+
T(n) = T(n - 1) + f(n), \quad \text{with} \quad c_1 n \le f(n) \le c_2 n.
9959
+
$$</p>
9960
+
<p><strong>Upper Bound</strong></p>
9961
+
<p>We conjecture $T(n) \le c_3 n^2$ for some constant $c_3$. Assume this holds for $T(k)$, i.e., $T(k) \le c_3 k^2$. Then,</p>
9962
+
<p>$$
9963
+
T(k+1) = T(k) + f(k+1) \le c_3 k^2 + c_2 (k+1).
9964
+
$$</p>
9965
+
<p>We want to show</p>
9966
+
<p>$$
9967
+
c_3 k^2 + c_2 (k+1) \le c_3 (k+1)^2.
9968
+
$$</p>
9969
+
<p>Expanding both sides:</p>
9970
+
<p>$$
9971
+
c_3 (k+1)^2 = c_3 k^2 + 2c_3 k + c_3,
9972
+
$$</p>
9973
+
<p>and</p>
9974
+
<p>$$
9975
+
c_3 k^2 + c_2 (k+1) = c_3 k^2 + c_2 k + c_2.
9976
+
$$</p>
9977
+
<p>Thus, we need</p>
9978
+
<p>$$
9979
+
c_2 k + c_2 \le 2c_3 k + c_3.
9980
+
$$</p>
9981
+
<p>This holds for $c_2 \le 2c_3$ and $c_2 \le c_3$, which is possible by choosing appropriate constants.</p>
9982
+
<p><strong>Lower Bound</strong></p>
9983
+
<p>The lower bound follows similarly by applying the lower bound $c_1 n$ for $f(n)$. Thus, we can conclude that</p>
<p>Show that a graph has a unique minimum spanning tree if, for every cut of the graph, there is a unique light edge crossing the cut. Show that the converse is not true by giving a counterexample.</p>
10063
10063
</blockquote>
10064
-
<p>(Removed)</p>
10064
+
<p><strong>Remark:</strong> Do not assume that all edge weights are distinct.</p>
10065
+
<p><strong>Part 1: Proving the Forward Direction</strong></p>
10066
+
<p><strong>Goal:</strong> Show that if every cut in the graph has a unique light edge crossing it, then the graph has exactly one MST.</p>
10067
+
<p><strong>Proof:</strong></p>
10068
+
<p>Assume, for contradiction, that the graph has <strong>two distinct MSTs</strong>, $T$ and $T'$.</p>
10069
+
<ol>
10070
+
<li>
10071
+
<p><strong>Identifying an Edge in $T$ but not in $T'$:</strong></p>
10072
+
<ul>
10073
+
<li>Since $T$ and $T'$ are distinct, there exists at least one edge that is in $T$ but not in $T'$.</li>
10074
+
<li>Let $(u, v)$ be such an edge.</li>
10075
+
</ul>
10076
+
</li>
10077
+
<li>
10078
+
<p><strong>Creating a Cut by Removing $(u, v)$:</strong></p>
10079
+
<ul>
10080
+
<li>Removing $(u, v)$ from $T$ divides it into two connected components (since trees are acyclic and connected).</li>
10081
+
<li>Let $T_u$ be the set of vertices reachable from $u$ without using $(u, v)$.</li>
10082
+
<li>Let $T_v$ be the set of vertices reachable from $v$ without using $(u, v)$.</li>
10083
+
<li>The sets $T_u$ and $T_v$ form a <strong>cut</strong> $(T_u, T_v)$ in the graph.</li>
10084
+
</ul>
10085
+
</li>
10086
+
<li>
10087
+
<p><strong>Unique Light Edge Crossing the Cut:</strong></p>
10088
+
<ul>
10089
+
<li>By assumption, the cut $(T_u, T_v)$ has a <strong>unique light edge</strong> crossing it.</li>
10090
+
<li>Let $(x, y)$ be this unique light edge.</li>
10091
+
<li>Note that $(u, v)$ crosses this cut because $u \in T_u$ and $v \in T_v$.</li>
10092
+
</ul>
10093
+
</li>
10094
+
<li>
10095
+
<p><strong>Analyzing the Unique Light Edge:</strong></p>
10096
+
<ul>
10097
+
<li>
10098
+
<p><strong>Case 1:</strong> If $(x, y) \ne (u, v)$, then:</p>
10099
+
<ul>
10100
+
<li>Since $(x, y)$ is the unique light edge and not $(u, v)$, it must have a weight <strong>less than</strong> $w(u, v)$.</li>
10101
+
<li><strong>Constructing a New Spanning Tree:</strong><ul>
10102
+
<li>Replace $(u, v)$ in $T$ with $(x, y)$ to get $T'' = T - { (u, v) } \cup {(x, y)}$.</li>
10103
+
<li>$T''$ is connected (since $(x, y)$ connects $T_u$ and $T_v$) and spans all vertices.</li>
10104
+
<li>The total weight of $T''$ is less than that of $T$ because $w(x, y) < w(u, v)$.</li>
10105
+
</ul>
10106
+
</li>
10107
+
<li><strong>Contradiction:</strong><ul>
10108
+
<li>$T$ was assumed to be an MST, but $T''$ has a lower total weight.</li>
10109
+
<li>This contradicts the minimality of $T$.</li>
10110
+
</ul>
10111
+
</li>
10112
+
</ul>
10113
+
</li>
10114
+
<li>
10115
+
<p><strong>Case 2:</strong> If $(x, y) = (u, v)$, then:</p>
10116
+
<ul>
10117
+
<li>The unique light edge crossing the cut is $(u, v)$.</li>
10118
+
<li><strong>Observing $T'$:</strong><ul>
10119
+
<li>Since $(u, v) \notin T'$, there must be a path from $u$ to $v$ in $T'$ (since $T'$ is connected).</li>
10120
+
<li>This path must cross the cut $(T_u, T_v)$ at least once.</li>
10121
+
<li>Let $e$ be an edge on this path that crosses the cut.</li>
10122
+
</ul>
10123
+
</li>
10124
+
<li><strong>Comparing Edge Weights:</strong><ul>
10125
+
<li>Since $(u, v)$ is the unique light edge crossing the cut, and $e \ne (u, v)$, it follows that $w(u, v) < w(e)$.</li>
10126
+
</ul>
10127
+
</li>
10128
+
<li><strong>Constructing a New Spanning Tree:</strong><ul>
10129
+
<li>Add $(u, v)$ to $T'$, creating a cycle.</li>
10130
+
<li>Remove $e$ from this cycle to get $T'' = T' + {(u, v)} - {e}$.</li>
10131
+
<li>$T''$ is connected and spans all vertices.</li>
10132
+
<li>The total weight of $T''$ is less than that of $T'$ because $w(u, v) < w(e)$.</li>
10133
+
</ul>
10134
+
</li>
10135
+
<li><strong>Contradiction:</strong><ul>
10136
+
<li>$T'$ was assumed to be an MST, but $T''$ has a lower total weight.</li>
10137
+
<li>This contradicts the minimality of $T'$.</li>
10138
+
</ul>
10139
+
</li>
10140
+
</ul>
10141
+
</li>
10142
+
</ul>
10143
+
</li>
10144
+
<li>
10145
+
<p><strong>Conclusion:</strong></p>
10146
+
<ul>
10147
+
<li>In both cases, assuming the existence of two distinct MSTs leads to a contradiction.</li>
10148
+
<li>Therefore, the initial assumption that there are two distinct MSTs is false.</li>
10149
+
<li><strong>Hence, the graph must have a unique MST.</strong></li>
10150
+
</ul>
10151
+
</li>
10152
+
</ol>
10153
+
<hr/>
10154
+
<p><strong>Part 2: Showing the Converse is Not True</strong></p>
10155
+
<p><strong>Goal:</strong> Provide a counterexample to show that a graph can have a unique MST even if not every cut has a unique light edge crossing it.</p>
<p>Argue that if all edge weights of a graph are positive, then any subset of edges that connects all vertices and has minimum total weight must be a tree. Give an example to show that the same conclusion does not follow if we allow some weights to be nonpositive.</p>
0 commit comments