Chapter 1: Algorithms
5
of edges/vertices is strictly increasing (it
started at E/V and each
time we deleted a vertex, less than
E/V edges were deleted by the
condition of our algorithm). Hence, it is impossible to reach a
stage when only 1
vertex is remaining, since in this case the
edges/vertices ratio is 0. So at some point, our
algorithm must
terminate, leaving us with a graph with more than one vertex, all
of whose
vertices have degree at least E/V. ■
Remark: This proof used the idea of monovariants, which we will
explore further in the next section.
The next problem initially appears to have nothing to do with
algorithms, but visualizing what it actually means allows us to
think about it algorithmically. The heuristics we develop lead us
to
a very simple algorithm, and proving that it works isn’t hard
either.
Do'stlaringiz bilan baham: