0% found this document useful (0 votes)
11 views82 pages

Lecture Notes For Cs 6550 Advanced Graduate Algorithms Randomized and Approximation Algorithms Spring 2019 Eric Vigoda Et Al PDF Download

The document contains lecture notes for CS 6550 on advanced algorithms, focusing on randomized and approximation algorithms, specifically Karger’s min-cut algorithm and the Karger-Stein algorithm. It outlines the definitions, algorithms, and analyses related to finding minimum cuts in undirected graphs, including their running times and success probabilities. The notes also reference foundational concepts from previous courses and provide a structured approach to understanding the algorithms presented.

Uploaded by

giovymafumi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views82 pages

Lecture Notes For Cs 6550 Advanced Graduate Algorithms Randomized and Approximation Algorithms Spring 2019 Eric Vigoda Et Al PDF Download

The document contains lecture notes for CS 6550 on advanced algorithms, focusing on randomized and approximation algorithms, specifically Karger’s min-cut algorithm and the Karger-Stein algorithm. It outlines the definitions, algorithms, and analyses related to finding minimum cuts in undirected graphs, including their running times and success probabilities. The notes also reference foundational concepts from previous courses and provide a structured approach to understanding the algorithms presented.

Uploaded by

giovymafumi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Lecture Notes For Cs 6550 Advanced Graduate

Algorithms Randomized And Approximation


Algorithms Spring 2019 Eric Vigoda Et Al
download
https://ebookbell.com/product/lecture-notes-for-cs-6550-advanced-
graduate-algorithms-randomized-and-approximation-algorithms-
spring-2019-eric-vigoda-et-al-50527386

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Lecture Notes For Cs 6750 Humancomputer Interaction Hci Summer 2017


David A Joyner Lecturer Shipra De Scribe

https://ebookbell.com/product/lecture-notes-for-cs-6750-humancomputer-
interaction-hci-summer-2017-david-a-joyner-lecturer-shipra-de-
scribe-51571696

Lecture Notes For Pyrotechnic Chemistry Pyrotechnic Referenceseries No


2 Revised Kosanke Kenneth L Kosanke Bj Jenningswhite Clive

https://ebookbell.com/product/lecture-notes-for-pyrotechnic-chemistry-
pyrotechnic-referenceseries-no-2-revised-kosanke-kenneth-l-kosanke-bj-
jenningswhite-clive-2000800

Lecture Notes For Multivariable Mathematics Math 3500 3510 Theodore


Shifrin

https://ebookbell.com/product/lecture-notes-for-multivariable-
mathematics-math-3500-3510-theodore-shifrin-10512296

Logic Lecture Notes For Philosophy Mathematics And Computer Science


1st Edition Andrea Iacona

https://ebookbell.com/product/logic-lecture-notes-for-philosophy-
mathematics-and-computer-science-1st-edition-andrea-iacona-27571442
Practical Volcanology Lecture Notes For Understanding Volcanic Rocks
From Field Based Studies Kroly Nmeth

https://ebookbell.com/product/practical-volcanology-lecture-notes-for-
understanding-volcanic-rocks-from-field-based-studies-kroly-
nmeth-2377234

Control System Design Lecture Notes For Me 155a Karl Johan Strm

https://ebookbell.com/product/control-system-design-lecture-notes-for-
me-155a-karl-johan-strm-44912556

Preclinical Medicine Pharmacology Review 2023lecture Notes For Usmle


Step 1 And Comlexusa Level 1 Usmle Prep Kaplan Medical

https://ebookbell.com/product/preclinical-medicine-pharmacology-
review-2023lecture-notes-for-usmle-step-1-and-comlexusa-level-1-usmle-
prep-kaplan-medical-53553540

Lecture Notes On Mathematical Olympiad Courses For Senior Section


Jiagu Xu

https://ebookbell.com/product/lecture-notes-on-mathematical-olympiad-
courses-for-senior-section-jiagu-xu-22496158

Lecture Notes On Mathematical Olympiad Courses For Senior Section


Jiagu Xu

https://ebookbell.com/product/lecture-notes-on-mathematical-olympiad-
courses-for-senior-section-jiagu-xu-22496160
CS 6550: Randomized algorithms Spring 2019

Lecture 1: Karger’s min-cut algorithm and the Karger-Stein algorithm


January 8, 2019
Lecturer: Eric Vigoda Scribes: Yingjie Qian, John Lambert

Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal publications.

1.1 Introduction
Definition 1.1 Given an undirected graph G = (V, E), let S ⊆ V and S̄ = V \ S. We define the cut(S, S̄)
to be the set of all edges with one end in S and the other in S̄. We use notation δ(S) = {(v, w) ∈ E : ∀v ∈
S, w ∈ S̄} for simplicity.

In this lecture, we want to solve the min-cut problem: Given G = (V, E), find S ⊂ V such that |δ(S)|
is minimum.
One easy way is to use max-flow. Recall the min-s,t-cut problem, which is given G and two vertices
s, t ∈ V , find cut(S, S̄) where s ∈ S, t ∈ S̄, with |δ(S)| minimum. To solve min-cut from min-s,t-cut: fix
s ∈ V and run it for all n − 1 other vertices as t. To solve min-cut: we can reduce it to max-s,t-flow and
use Edmond’s Karp algorithm to solve it. We refer the readers to CS 6505 notes for details.
In this lecture, we present Karger’s min-cut algorithm [1] in section 1.2.1 and the Karger-Stein algo-
rithm [2] in section 1.3.1. We will then analyze their running times and success probabilities in section 1.2.2
and 1.3.2, respectively.

1.2 Karger’s min-cut algorithm


1.2.1 The algorithm
In this section, we first introduce a new action on graph called contraction. Then, we provide some intuition
before formally presenting Karger’s min-cut algorithm.
Given a graph G = (V, E), for an edge e = (v, w) ∈ E, we call the following action as contracting e to
obtain a new graph, denoted by G/e:
1. Replace vertices v and w by new vertex y.
2. For all edges (v, z) ∈ E in original graph G, replace by (y, z); for all edges (w, z) ∈ E, replace by (y, z).
3. Drop all edges (v, w) ∈ E.
Note that G/e is a multi-graph without self-loops. We have the following observations on edge contractions:
For a given graph G = (V, E) and e = (v, w) ∈ E, let G0 = G/e. Consider cuts in G and cuts in G0 , then
every cut in G0 corresponds to a cut in G. For a subset S ⊂ V , where e ∈ S, then δG (S) = δG0 (S). Now,
consider contracting a sequence of edges e1 , e2 , . . . , en−2 . Since the number of vertices decreases by one via
each contraction, there are two big meta-vertices left. Note that the (multi-)edges between those two vertices
represent the cut(S 0 , S̄ 0 ) in G, where the vertices in S 0 and S̄ 0 are contracted into those two big meta-vertices
respectively.
Fix a cut (S ? , S̄ ? ) of minimum size |δ(S ? )| = k. We want all of these edges e1 , e2 , . . . , en−2 ∈
/ δ(S ? ). In
a randomized algorithm, just take guesses at choosing edges. The minimum cut is small, so if you choose a
random edge from the whole graph, it is unlikely that it will be in the cut. Below is the formal algorithm.

1-1
Lecture 1: Karger’s min-cut algorithm and the Karger-Stein algorithm 1-2

Algorithm 1: Karger’s min-cut algorithm


input : Graph G = (V, E).
1 n ← |V (G)|, C ← E;
n

2 for i ← 1 to l 2 do
3 G0 ← G;
4 repeat
5 Choose an edge e ∈ E(G0 );
6 G0 ← G0 /e;
7 until |V (G0 )| = 2;
8 if |C| ≥ |E(G0 )| then
9 C ← E(G0 );
output: C.

1.2.2 Analysis
We can use adjacency lists or an adjacency matrix to represent the graph. Then, a single edge contraction
operation can be implemented with a linear number of updates to the data structure. It follows that the
running time for contracting any given graph to two vertices is O(n2 ) as we contract n − 2 edges. So the
total running time for the algorithm is O(n4 ).
Now, we will show that the success probability of the algorithm is:

P ∗ := Pr algorithm outputs the global min cut ≥ 1 − e−l .




Fix S ∗ ⊂ V such that cut (S ∗ , S̄ ∗ ) is of minimum size k. It suffices to show that for a single run,
1
P := Pr algorithm outputs min cut (S ∗ , S̄ ∗ ) for a single run ≥ n .

2

n

Suppose we can prove the above inequality, since we run the algorithm l 2 times and output the best cut
n
found, the probability of all l n2 runs do not find the min cut is (1 − P )l( 2 ) . Thus,


n n
P ∗ ≥ 1 − (1 − P )l( 2 ) ≥ 1 − e−P l( 2 ) ≥ 1 − e−l .
1

We are left to show P ≥ / δ(S ? ) .
. By observation, P = Pr e1 , e2 , . . . , en−2 ∈
(n2 )
Then,
k
/ δ(S ∗ )) = 1 −
Pr(e1 ∈ .
|E(G)|
We now claim that G has minimum degree k, otherwise G has cut of size smaller than k,
Pwhich is the kn
set
of all edges that has one fixed minimum degree vertex as one end. Then, |E(G)| = 21 deg(v) ≥ 2 .
v∈V (G))
Thus,
k k 2
/ δ(S ∗ )) = 1 −
Pr(e1 ∈ ≥1− =1− .
|E(G)| kn/2 n
G/e1 still has minimum degree k, otherwise G/e1 has cut of size smaller than k, which corresponds to cut
of size smaller than k in G. Then, |V (G/e1 )| = n − 1 and |E(G/e1 )| ≥ k(n−1)
2 . Thus,

k 2
/ δ(S ? ) | e1 ∈
/ δ(S ? ) ≥ 1 −

Pr e2 ∈ =1− .
k(n − 1)/2 n−1
Lecture 1: Karger’s min-cut algorithm and the Karger-Stein algorithm 1-3

Similarly, for i = 3, 4, . . . , n − 2,
k 2
/ δ(S ? ) | ej ∈
/ δ(S ? ), ∀j < i ≥ 1 −

Pr ei ∈ =1− .
k(n − (i − 1))/2 n−i+1

Thus,

/ δ(S ? )

P = Pr e1 , e2 , . . . , en−2 ∈
= P r(e1 ∈/ δ(S ? )) × P r(e2 ∈
/ δ(S ? ) | e1 ∈/ δ(S ? )) × P r(e3 ∈
/ δ(S ? ) | e1 , e2 ∈
/ δ(S ? )) × . . .
2 2 2 2
≥ (1 − ) × (1 − ) × (1 − ) × · · · × (1 − )
n n−1 n−2 3
n−2 n−3 n−4 2 1
=( )×( )×( ) × ··· × ( ) × ( )
n n−1 n−2 4 3
2
= .
n × (n − 1)
1
= n as desired.
2

n

Note that the algorithm also implies that for any graph G, there are at most 2 minimum cuts.

1.3 The Karger-Stein algorithm


Consider the calculations in the last section. During the sequence of edge contractions, the probability of
choosing right edges is high at the beginning but low later since there are small number of vertices left. The
Karger-Stein algorithm uses the general framework of that in the Karger’s mincut algorithm but runs the
“later” part more times.

1.3.1 The algorithm


Suppose we contract edges from n vertices to l vertices twice. We can choose l to have the probability of
success is about 21 . So in expectation, one of the two runs work. Then we recurse each of these bifurcates.
Take best of two, then pop back up from the recursion.
Now, we want to choose l. Similar to the previous calculations, the probability of success of running from
n vertices to l is
l

n−2 n−3 l−1 l(l − 1) 2
× × ··· × = = n .
n n−1 l+1 n(n − 1) 2

(2l ) 1 n
Then, we have ≥ by taking l = √ + 1. Below is the algorithm:
(n2 ) 2 2
Lecture 1: Karger’s min-cut algorithm and the Karger-Stein algorithm 1-4

Algorithm 2: The Karger-Stein algorithm: KargerStein(G)


input : Graph G with n vertices.
1 if n ≥ 6 then
2 Do 2 runs and output the best of the 2:
3 Use Karger’s mincut algorithm to contract edges until √n2 + 1 vertices are left, denoted as G0 ;
4 Recurse KargerStein(G’).

Note that 6 is chosen in the algorithm as √6 + 1 ≥ 2.


2

1.3.2 Analysis
First, let us calculate the new running time for running it once. Then,
n
T (n) = 2T ( √ ) + O(n2 ).
2

By the Master Theorem, T (n) = O(n2 log n).


Now, we can also write a recurrence relation for the success probability. The probability of success to
contract from n vertices to √n2 + 1 is no smaller than a half. Thus,

1 n 2
P (n) ≥ 1 − 1 − P ( √ ) .
2 2

One can easily use induction to verify that P (n) = Ω( ln1n ). So if we do O(log2 n) runs, the success probability
1
is at least 1 − poly(n) . Hence, the total running time of the algorithm is O(n2 log3 n).

References
[1] Karger, David R.. Global min-cuts in RNC, and other ramifications of a simple min-cut algorithm.
Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, 1993.
[2] Karger, David R. and Stein, Clifford. A new approach to the minimum cut problem. Journal of the
ACM, 43(4):601-640, 1996.
Lecture Notes on Karger’s Min-Cut Algorithm.
Eric Vigoda
Georgia Institute of Technology
1
Last updated for 7530 - Randomized Algorithms, Spring 2010.

Today’s topic: Karger’s min-cut algorithm.


Let G = (V, E) be an undirected graph. Let n = |V |, m = |E|.
For S ⊂ V , the set δ(S) = {(u, v) ∈ E : u ∈ S, v ∈ S} is a cut since their removal from G disconnects G into
more than one component.
Goal: Find the cut of minimum size.
Closely related is the minimum st-cut problem. In this problem, for specified vertices s and t we restrict
attention to cuts δ(S) where s ∈ S, t ∈
/ S.
Traditionally, the min-cut problem was solved by solving n − 1 min-st-cut problems. In the min-st-cut
problem we are given as input two vertices s and t, our aim is to find the set S where s ∈ S and t ∈ / S
which minimizes the size of the cut (S, S), i.e., |δ(S)|. The size of the min-st-cut is equal to the value of the
max-st-flow (equivalent by linear programming duality). The fastest algorithm for solving max-st-flow runs
in O(nm log(n2 /m)) time [1]. In fact, all n − 1 max-st-flow computations can be done simultaneously with
the same time bounds [2].
Karger [3] devised a simple, clever algorithm to solve the min-cut problem (without the st-condition) without
using any max-flow computations. An refinement of Karger’s algorithm, due to Karger and Stein [4] is also
faster than the above approach using max-st-flow computations. We will present Karger’s algorithm, followed
by the refinement.
The basic operation in the algorithm is to contract edges, which is defined below. The algorithm will start
initially with a simple graph as input, and then it will need to consider multigraphs. In a multigraph there
are possibly multiple edges between a pair of vertices. We do not have edges of the form (v, v) in our
multigraphs; we refer to these types of edges as “self-loops”.

Definition 1 Let G = (V, E) be a multigraph without self loops. For e = {u, v} ∈ E, the contraction with
respect to e, denoted G/e, is formed by:

1. Replace vertices u and v with a new vertex, w.


2. Replace all edges (u, x) or (v, x) with an edge (w, x).
3. Remove self-loops to w. G/e is a multigraph.

The key observation is that if we contract an edge (u, v) then we preserve those cuts where u and v are both
in S or both in S.

Observation 2 Let e = (u, v) ∈ E. There is a one-to-one correspondence between cuts in G which do not
contain any edge (u, v), and cuts in G/e. In fact, for S ⊂ V such that u, v ∈ S, δG (S) = δG/e (S) (with w
substituted for u and v).

The idea of the algorithm is to contract n − 2 edges and then two vertices remain. These two vertices
correspond to a partition (S, S) of the original graph, and the edges remaining in the two vertex graph
1 Based on scribe notes first prepared by Tom Hayes at the University of Chicago in the winter quarter, 2003.

1
correspond to δ(S) in the original input graph. So we will output this cut δ(S) as what think is the
minimum cut of the original input graph. What edges do we contract? If we never contract edges from a
minimum cut δ(S ∗ ), then, by Observation 2, this is the cut the algorithm will end up with. Since δ(S ∗ ) is
of minimum size, it has relatively few edges, so if we contract a random edge it turns out that we will have
a reasonable probability of preserving this min-cut δ(S ∗ ). Here is the formal algorithm.
Karger’s min-cut algorithm:
Starting from the input graph G = (V, E), repeat the following process until only two vertices remain:

1. Choose an edge e = (u, v) uniformly at random from E.

2. Set G = G/e.

These final two vertices correspond to sets S, S of vertices in the original graph, and the edges remaining in
the final graph correspond to the edges in δ(S), a cut of the original graph.
Claim: This process has a reasonable chance of ending at a minimum cut of the original graph.
Fix some minimum cut δ(S) in the original graph. Let |δ(S)| = k.

Lemma 3 Let δ(S) be a cut of minimum size of the graph G = (V, E).

1
Pr ( Karger’s algorithm ends with the cut δ(S) ) ≥ n .

2

Proof: Denote the edges we contract in the algorithm as {e1 , e2 , . . . , en−2 }. The algorithms succeeds if none
of the contracted edges are in δ(S). To upper bound the probability that the algorithm succeeds in the first
contraction, i.e., that e1 ∈
/ δ(S) we need to lower bound the number of edges in the input graph G in terms
of k. Note, the minimum degree is at least k in G, otherwise we have a cut of size smaller than k since we
can disconnect the vertex from the rest of the graph by removing all edges incident to it. This implies that
the original input graph G has at least nk/2 edges. By Observation 2, since every cut in an intermediate
multigraph corresponds to a cut of the original graph, we have the following observation.

Observation 4 The minimum degree in all of the intermediate multigraphs is at least k. Otherwise, the
edges incident the (meta)vertex with degree smaller than k would correspond to a cut of size < k in the
original graph.

After j contractions, the multigraph, denote as Gj , contains n − j vertices since we lose one vertex per
contraction. Then, Observation 4 implies that Gj has at least (n − j)k/2 edges.
We can now compute the probability the algorithm successfully finds our specific minimum cut δ(S). To do
so, all of the contracted edges must not be in δ(S):

Pr ( final graph = δ(S) ) = Pr ( e1 , e2 , . . . , en−2 ∈


/ δ(S) )
n−3
Y
= Pr ( e1 ∈
/ δ(S) ) Pr ( ej+1 ∈
/ δ(S)|e1 , . . . , ej ∈
/ δ(S) )
j=1
n−3
Y 
k
≥ 1−
j=0
(n − j)k/2

2
n−2 n−3 2 1
= × × ··· × ×
n n−1 4 3
2
=
(n)(n − 1)
1
= n .

2

n

In order to boost the probability of success, we simply run the algorithm ` 2 times. The probability that
at least one run succeeds is at least
!`(n2 )
1
1 − 1 − n ≥ 1 − e−` .
2

Setting ` = c ln n we have error probability ≤ 1/nc .


It’s easy to implement Karger’s algorithm so that one run takes O(n2 ) time. Therefore, we have an O(n4 log n)
time randomized algorithm with error probability 1/poly(n).
A faster version of this algorithm was devised by Karger and Stein [4]. The key idea comes from looking at
the telescoping product. In the initial contractions it’s very unlikely we contracted an edge in the minimum
cut. Towards the end of the algorithm, our probability of contracting an edge in the minimum cut grows.
From the earlier analysis we have the following.
  For a fixed minimum √ cut δ(S), the probability that this cut
survives down to ` vertices is at least 2` / n2 . Thus, for ` = n/ 2 we have probability ≥ 1/2 of succeeding.
Hence, in expectation two trails should suffice.
Improved algorithm: From a multigraph G, if G has at least 6 vertices, repeat twice:

1. run the original algorithm down to n/ 2 + 1 vertices.
2. recurse on the resulting graph.

Return the minimum of the cuts found in the two recursive calls.
The choice of 6 as opposed to some other constant will only affect the running time by a constant factor.
We can easily compute the running time via the following recurrence (which is straightforward to solve, e.g.,
the standard Master theorem applies):
 √ 
T (n) = 2 n2 + T (n/ 2) = O(n2 log n).


Since we succeed down to n/ 2 with probability ≥ 1/2, we have the following recurrence for the probability
of success, denote by P (n):
2


1
P (n) ≥ 1 − 1 − P (n/ 2 + 1) .
2
 
This solves to P (n) = Ω log1 n . Hence, similar to the earlier argument for the original algorithm, with
O(log2 n) runs of the algorithm, the probability of success is ≥ 1 − 1/poly(n).
Therefore, in O(n2 log3 n) total time, we can find the minimum cut with probability ≥ 1 − 1/poly(n).
Before finishing, we observe an interesting corollary of Karger’s original algorithm which we will use in the
next lecture to estimate the (un)reliability of a network.

3
Corollary 5 Any graph has at most O(n2 ) minimum cuts.

This follows from Lemma 3 since that holds for any specified minimum cut.
Note, we can also enumerate all of these cuts by the above algorithm.

References
[1] A. V. Goldberg and R. E. Tarjan. A new approach to the maximum-flow problem. J. Assoc. Comput.
Mach., 35(4):921–940, 1988.
[2] J. Hao and J. B. Orlin. A faster algorithm for finding the minimum cut in a graph. In Proceedings of
the Third Annual ACM-SIAM Symposium on Discrete Algorithms (Orlando, FL, 1992), pages 165–174,
New York, 1992. ACM.
[3] D. R. Karger. Global min-cuts in RNC, and other ramifications of a simple min-cut algorithm. In
Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms (Austin, TX, 1993),
pages 21–30, New York, 1993. ACM.
[4] D. R. Karger and C. Stein. A new approach to the minimum cut problem. J. ACM, 43(4):601–640, 1996.

4
CS 6550: Randomized Algorithms Spring 2019

Lecture 2: Median Finding


January 10, 2019
Lecturer: Eric Vigoda Scribes: Daniel Hathcock, Shyamal Patel

Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal publications.

2.1 Classical Median Finding Algorithms


Given an unsorted list of n numbers S = [S1 , . . . , Sn ], find the median (n is assumed to be odd for conve-
nience). There are many algorithms to do this:
• Easy: sort in O(n log n) time, output middle element.
• Non-trivial: median of medians algorithm, deterministically finds median in O(n) time via divide
and conquer, originally by Blum et. al [2].

• Trivial (randomized): quickselect algorithm finds median in O(n) expected time


• Non-trivial (randomized): the main algorithm presented here finds the median in O(n) with high
probability (whp).
Definition 2.1. An event An which depends on some parameter n occurs with high probability (whp) if
1
P(An ) ≥ 1 −
nc
for some c > 0. Or sometimes, alternatively, if

P(An ) ≥ 1 − o(1)

The randomized quickselect approach to finding the median of S is to choose some “good” pivot p, then
partition S into S<p , S=p , and S>p . Then recurse, using the sizes of parts to determine which contains the
median.
What does it mean to have a good pivot? |S<p | ≤ 43 n and |S>p | ≤ 34 n. If this is the case, then the
running time has the recurrence relation T (n) ≤ T ( 43 n) + O(n) which is O(n) by the master theorem. (note
that 34 is arbitrary. Any constant larger than 12 and less than 1 is fine).
To find a good pivot, choose randomly. Half of the elements are good pivots, so in expectation, we will
have to choose two pivots. Since the pivot is good in expectation after only O(1) trials, then the algorithms
finishes in expected O(n) time. However, if we want to get O(n) time with high probability instead, then
we need a different algorithm.

2.2 Find Median With High Probability


Idea: Suppose m is the median. Choose some ` and u such that ` ≤ m ≤ u, and both ` and u are “close” to
m. Consider the set  
n
C = {x ∈ S | ` ≤ x ≤ u}, with |C| = o
log n

2-1
Lecture 2: Median Finding 2-2

C contains the median by our assumption on ` and u, and it is small enough to sort efficiently. So, we sort
C and find the ( n+1
2 − |S<` |)
th
smallest element, which is the median of S.
To find ` and u, choose a random subset R ⊆ S of size n3/4 , and sort it. It is hard to sample a true
subset, so instead choose R by sampling n3/4 elements randomly with replacement, creating a multiset. We
let  3/4 th  3/4 th
n √ n √
`= − n smallest element and u= + n smallest element
2 2

using n intuitively as the standard deviation (and also because this is what makes the analysis work out
nicely). This is the entire algorithm, with the condition that the algorithm returns failure if the randomly
chosen ` and u are not good enough (either the median is not between them, or they are too far apart):

Algorithm 1: Randomized Find Median with high probability


input : List S of n integers, n odd
output: The median of S, or FAIL
1 R ← choose n3/4 elements from S (u.a.r. and with replacement);
2 sort R;
 3/4 √ th
3 ` ← n2 − n smallest element of R;
 3/4 √ th
4 u ← n2 + n smallest element of R;
5 C ← {x ∈ S | ` ≤ x ≤ u}, S<` ← {x ∈ S | x < `}, S>u ← {x ∈ S | x > u};
6 if |S<` | ≥ n2 or |S>u | ≥ n2 then
7 output FAIL;
8 if |C| > 4n3/4 then
9 output FAIL;
10 else
11 sort C;
n+1
th
12 output 2 − |S<` | smallest element of C;

Note that the above algorithms works as long as the elements in S are distinct (consider the case where
S contains only many copies of 1, then C will always have size n) If S is allowed to have repeat elements,
then the algorithm must be slightly modified so that in line 5, the comparisons being done take into account
a total order defined on the elements (for example, where ties are broken based on the original index in the
list S).

2.3 Analysis
2.3.1 Runtime Analysis
Claim 2.2. The randomized find median with high probability algorithm runs in O(n) time.
Proof. Sampling n3/4 elements with replacement takes o(n) time. Then, sorting R takes
O(n3/4 log n3/4 ) = o(n) time
After sorting, finding ` and u are both O(1) operations. Partitioning S into C, S<` , and S>u can easily
(naively) be done by passing over S and comparing each element to both ` and u. This clearly takes O(n)
time. Checking the sizes of each of the sets in the partition is constant time, and assuming FAIL was not
outputted, then sorting C takes
O(4n3/4 log 4n3/4 ) = o(n) time
Lecture 2: Median Finding 2-3

Finally, finding the median of S from the sorted list C is constant time. So, in total, each of the constant
number of steps is O(n), so the entire algorithm takes O(n) time

There is a lower bound proved on the number of comparisons required for deterministic median finding
algorithms in the worst case: 2n + o(n) [1]. A single run of the presented randomized algorithm (assuming
it succeeds), can be shown to perform better (by a constant factor) if line 5 of the algorithm is implemented
slightly more efficiently.
3
Claim 2.3. The randomized median finding algorithm performs 2n + o(n) comparisons in the worst case
(assuming success).
Proof. The only comparisons performed in the algorithm are in the steps which sort R, sort C, and partition
S. Assuming success, sorting R and C both take o(n) comparisons.
Partitioning S can be done by passing over S once, comparing each element to `, and only comparing it
to u if it is greater than `. This results in

n + (n − |S<` |) comparisons

However, notice that


n n
|S<` | < − 4n3/4 =⇒ |S>u | > or |C| > 4n3/4 =⇒ output FAIL
2 2
n n
Since we assumed that the algorithm does not output fail, this means that |S<` | ≥ 2 − 4n3/4 = 2 − o(n).
So, the total number of comparisons is
n 3
2o(n) + n + (n − |S<` |) ≤ 2o(n) + 2n − + o(n) = n + o(n)
2 2

2.3.2 Failure Probability


We will show that the probability of failure P(FAIL) < n−1/4 . Showing this statement in turn implies that
we succeed with high probability. To show this we first define the following events:
n
E1 := |S<` | ≥
2
n
E2 := |S>u | ≥
2
E3 := |C| > 4n3/4

We will show that


Claim 2.4. P(E1 ), P(E2 ) < 41 n−1/4

Claim 2.5. P(E3 ) < 12 n−1/4


Using a union bound argument, we then get that these two claims imply

P(FAIL) ≤ P(E1 ) + P(E2 ) + P(E3 ) < n−1/4

as desired.
Lecture 2: Median Finding 2-4

2.3.2.1 Bernoulli Random Variables and Chebychev’s Inequality


Before we proceed with the proofs, we will first recall some facts about Bernoulli random variables. Recall
that if Xi ∼ Bernoulli(p) then
(
1 with probability p
Xi =
0 otherwise
E[Xi ] = p
Var(Xi ) = E[Xi2 ] − (E[Xi ])2 = p − p2 = p(1 − p)

Moreover, if the variables X1 , X2 , ..., Xs are independent and we let Z = X1 + ... + Xs then

Var(Z) = sp(1 − p)

Another fact that will be key in proving the two claims is


Theorem 2.6 (Chebychev’s Inequality). For a random variable, X, we have that:
 Var(X)
P X − E[X] ≥ a ≤
a2

2.3.2.2 Proofs
We will first show that P(E1 ) and P(E2 ) are both small, which implies that the center will likely contain the
median.

Proof of Claim 2.4. We will only show P(E1 ) < 41 n−1/4 . The other inequality will follow by an analogous
argument.
3/4 √
Notice that in order to have that |S<` | ≥ n2 we must have that |{r ∈ R : r ≤ m}| < n 2 − n. So now
let R = {r1 , ..., rn3/4 } and define the random variable Xi such that
(
1 if ri ≤ m
Xi =
0 otherwise

Pn3/4
And let Y = i=1 Xi . Now notice that the random variables Xi are Bernoulli random variables. As
such we can calculate the expectations and variance for each Xi and Y .
n−1
+1 1 1
E[Xi ] = P(Xi = 1) = 2 = +
n 2 2n
n3/4
 
3/4 1 1 1
E[Y ] = n + = + 1/4
2 2n 2 2n
n3/4 n3/4
  
1 1 1 1 1
Var(Y ) = n3/4 + − = − 5/4 <
2 2n 2 2n 4 4n 4

Now by Chebychev’s Inequality we have that

n3/4 √ √ Var(Y ) n3/4 1


P(E1 ) ≤ P(Y < − n) ≤ P(|Y − E[Y ]| > n) ≤ < = 1/4
2 n 4n 4n
which completes the proof.

So now it only remains to show that the center will be small with high probability.
Lecture 2: Median Finding 2-5

Proof of Claim 2.5. Notice that if |C| > 4n3/4 then we must have that either |{x ∈ C : x ≥ m}| > 2n3/4 or
|{x ∈ C : x ≤ m}| > 2n3/4 . We will show that P(|{x ∈ C : x ≥ m}| > 2n3/4 ) < 4n11/4 .
Notice that if we have that |{x ∈ C : x ≥ m}| > 2n3/4 then we must have that u is one of the n2 − 2n3/4
3/4 √
largest elements of S. Hence at least n 2 − n elements of R, namely the elements of R that are bigger
than u, are from the n2 − 2n3/4 largest elements of S. So now let:
(
1 if ri ≥ n2 + 2n3/4 smallest element of S
Xi =
0 otherwise

Then we have that


n
2 − 2n3/4 1 2
E[Xi ] = = − 1/4
n 2 n
Pn3/4
If we again define Y = i=1 Xi then it follows that

n3/4 √
 
1 2
E[Y ] = n3/4 − −2 n
=
2 n1/4 2
n3/4 n3/4
  
3/4 1 2 1 2
Var(Y ) = n + 1/4 − 1/4 = − 4n1/4 <
2 n 2 n 4 4

So by Chebychev’s Inequality we have that

n3/4 √ √  Var(Y ) n3/4 1


P(Y ≥ − n) ≤ P Y − E[Y ] ≥ n ≤ < = 1/4
2 n 4n 4n
1
By an analogous argument, we have that P(|{x ∈ C : x ≤ m}| > 2n3/4 ) < 4n1/4
. Hence, by another union
bound argument, we have that
1 1 1
P (E3 ) < 1/4
+ 1/4 = 1/4
4n 4n 2n

References
[1] S. Bent and J. John. Finding the median requires 2n comparisons. In Proceedings of the 17th Annual
ACM Symposium on Theory of Computing, Providence, Rhode Island, pages 213216, 1985

[2] M. Blum, R.W. Floyd , V. Pratt , R.L. Rivest , and R.E. Tarjan. Time bounds for selection. Journal of
Computer and System Sciences, v.7 n.4, pages 448–461, 1973.
CS 6550: Randomized Algorithms Spring 2019

Lecture 3: Chernoff Bounds


January 15, 2019
Lecturer: Eric Vigoda Scribes: Federico Bruvacher and Michael Wigal

Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal publications.

3.1 Chernoff Bounds


3.1.1 Markov and Chebyshev Inequality
For a Random Variable X, we denote E[X] = µ and Var(X) = σ 2 .

Lemma 3.1 (Markov Inequality) Let X be a non-negative random variable, and a > 0, then
µ
Pr(X > a) ≤
a
Lemma 3.2 (Chebyshev Inequality) Let X be a non-negative random variable for which Var(X) exists,
then for all k > 0
1
Pr(|X − µ| > kσ) ≤
k2
A more general form being,

Var(X)
r ≥ 0Pr(|x − µ| > r) ≤
r2
Proof: Note that Y = (X − µ)2 is a non-negative random variable, we can then apply the Markov
Inequality to Y .
Note that Chebyshev does not always give a good bound. We give an example. Let
(
1 with probability 21
Xi =
0 with probability 12
Pn √
n
Let X = i=1 Xi , then from previous lecture we know E[X] = n2 and Var(X) = n
4, with σ = 2 .
Note for n = 1000, X = Bin(1000, 21 ) by the Chebyshev Inequality we have,

1 1 250
Pr(X ≥ 750) = Pr(|X − 500| ≥ 250) ≤ = 0.002
2 2 2502
We can calcultate this probability directly,

1000  
X 1000 −1000
Pr(X ≥ 70) = 2 ≈ 60 × 10−58
i=750
i

Note that the Chebyshev Inequality is significantly off.

3-1
Lecture 3: Chernoff Bounds 3-2

3.1.2 Chernoff “argument” for Bin(n, 12 )


Note that if X = Bin(n, 21 ), using Chernoff Bounds we can obtain bounds,


n 2
Pr(X ≥ µ + t ) ≤ e−t /2 (∗)
2√
n 2
Pr(X ≤ µ − t ) ≤ e−t /2
2
We first argue (*) to show the inuition behind the general Chernoff Bound.
Proof: We first want to transform X = X1 + · · · + Xn such that it has mean 0. Let

(
1 with probability 12
Yi = −1 + 2Xi = 1
−1 with probability 2

Note then that E[Y ] = 0. Since Var(Yi ) = 1, this implies Var(Y ) = n.


Note that Y1 + · · · Yk can be interpreted as a√unbiased random walk on the integers starting √at 0.

The original bound we wanted was X ≥ n2 +t 2n , which is equivalent to Y ≥ −n+2( n2 +2( n2 +t 2n ) = t n.
When we are far away from 0, adding 1 can be approximated by instead multiplying by (1 + λ) for some
tiny λ. If λ is small enough then (1 + λ)(1 + λ) = 1 + 2λ + λ2 ≈ 1 + 2λ.
Let Zi = (1 + λ)Yi where we will choose λ later. Note
(
1 + λ with probability 12
Zi = 1 1
1+λ with probability 2

Note then that Z = Z1 · Z2 · · · Zn = (1 + λ)Y1 ...(1 + λ)Yn = (1 + λ)Y .


What we have done is transformed the random walk model, where if the random walk was at u, then in
the new model the random walk would be at (1 + λ)u . Since Z is now a non-negative random variable, we
can now utilize the Markov Inequality. Since Yi are pairwise independent, so are the Zi . It follows,


n n √
Pr(X ≥ +t ) = Pr(Y ≥ t n)
2 2 √
= Pr(Z ≥ (1 + λ)t n
√1
For example, by a smart choice of lambda and Taylor Series approximation, 1 + λ ≈ e n .


Pr(Z ≥ (1 + λ)100 n
) = Pr(Z ≥ e100 )
Note that e100 is a big number, thus Markov Inequality would give a good bound. To make things
rigorous,

1 1 1
E[Zi ] = (1 + λ) + (
2 2 1+λ
1 λ2 + 2λ + 2
= ( )
2 1+λ
λ2
=1+
2 + 2λ
λ2
≤1+
2
Lecture 3: Chernoff Bounds 3-3

λ2 n √1 ,
It follows that E[Z] ≤ (1 + 2 ) . Note then that for λ = n

√ E[Z]
Pr(Z ≥ (1 + λ)t n
)≤ √
(1 + λ)t n
2
(1 + λ2 )n
= √
(1 + λ)t n
2
t n
(1 + 2n )
= √
t t n
(1 + n )

t2
e2 −t2
≤ t2 = e 2 .
e
where we are cheating on the denominator of ≤ inequality.

3.1.3 Chernoff Inequality


Now that we have given an intuition on the proof we can move to the rigorous proof.
Pn
Let Xi , · · · , Xn be Independent Bernoulli R.V.s where 0 ≤ Xi ≤ 1 Let X = i=1 Xi and µ = E[X] For
all 0 < ε ≤ 1

2
Pr(X ≥ µ(1 + ε)) ≤ e−µ·(ε /3)

2
Pr(X ≤ µ(1 − ε)) ≤ e−µ·(ε /2)

We want to know :

Pr(X ≥ µ(1 + ε))

Note as X is non-negative, we can choose an arbitrary t, then we exponentiate both sides and raise both
sides to the power t for some arbitrary t,

Pr(eX ≥ eµ(1+ε) )
Pr(etX ≥ etµ(1+ε) )

We know the applying Markov’s inequality:

E[etX ]
Pr(etX ≥ etµ(1+ε) ) ≤ (A)
etµ(1+ε)
Because the Xi = Bernoulli(pi ) and 1 + x ≤ ex then
t
−1)
E[etXi ] = pi et + (1 − pi ) = 1 + pi (et − 1) ≤ epi (e

Then the moment generating function:

n
Y t t
−1) −1)
E[etX ] ≤ epi (e = eµ(e (B)
i=1

Let’s substitute B in A:
Lecture 3: Chernoff Bounds 3-4

eε−1 µ
Pr(etX ≥ etµ(1+ε) ) ≤ ( ) = (eε−(1+ε) log(1+ε) )µ (C)
et(1+ε)
In the last equality we plugged in t = ln(1 + ε)to minimize.
Taylor expansion for : log(1 + ε) = ε − ε2 /2 + ε3 /3 + · · · Then: (1 + ε) log(1 + ε) = ε − ε2 /2 + ε2 + ε3 /3 −
ε3 /2 + · · · ≥ ε + ε2 /2 − ε3 /6 = ε + ε2 /3 Using this in C:

eε 2/3
( 1+ε
) µ ≤ eε µ
(1 + ε)
CS 6550: Randomized Algorithms Spring 2019

Lecture 4: Streaming: Frequency moments


January 17, 2019
Lecturer: Eric Vigoda Scribes: Mengfei Yang, Yatharth Dubey

Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal publications.

Theorem 4.1 Chernoff bounds: Let X1 , X2 , ..., Xn be independent variables, where 0 ≤ Xi ≤ 1. Let
n
X
X= Xi , µ = E[X]
i=1
.
Then for 0 ≤ δ ≤ 1,
δ2 µ
P r[X ≥ (1 + δ)µ] ≤ e− 3

δ2 µ
P r[X ≤ (1 − δ)µ] ≤ e− 2

4.1 Warm-up example: Median estimate


4.1.1 Problem definition
Definition 4.2  − approximate median: Given unordered list S = [X1 , X2 , ..., Xm ], for simplicity, assume
Xi0 s are distinct.
The rank of y is given by
rank(y) = |{x ∈ S : x ≤ y}|

The goal is to find an  − approximate median of S. That is, given  > 0, find y ∈ S where
m m
− m < rank(y) < + m
2 2

4.1.2 Solution
The intuition is choose some random elements from the list, and output the median of these elements. Then
prove this median is  − approximate median.
algorithm 1 select t ≥ 22 log 1δ random elements from S, then sort these random elements and output the
median.

Algorithm 1: Find median


input : An unordered list S = [X1 , X2 , ..., Xm ].
output: One integer represents the median
1 R = [r1 , r2 , ..., rt ] ←−choose t random elements from S;
2 sort(R);
3 return median(R)

4-1
Random documents with unrelated
content Scribd suggests to you:
LOCH AWE

Back to Loch Awe station, and presently onward past the Falls of
Cruachan and through the grim Pass of Brander,—down which the
waters of the Awe rush in a sable flood between jagged and
precipitous cliffs for miles and miles,—and soon we see the bright
waves of Loch Etive smiling under a sunset sky, and the many bleak,
brown hills that fringe Glen Lonan and range along to Oban and the
verge of the sea. There will be an hour for rest and thought. It
seems wild and idle to write about these things. Life in Scotland is
deeper, richer, stronger, and sweeter than any words could possibly
be that any man could possibly expend upon it. The place is the
natural home of imagination, romance, and poetry. Thought is
grander here, and passion is wilder and more exuberant than on the
velvet plains and among the chaste and stately elms of the South.
The blood flows in a stormier torrent and the mind takes on
something of the gloomy and savage majesty of those gaunt,
barren, lonely hills. Even Sir Walter Scott, speaking of his own great
works,—which are precious beyond words, and must always be
loved and cherished by readers who know what beauty is,—said that
all he had ever done was to polish the brasses that already were
made. This is the soul of excellence in British literature, and this,
likewise, is the basis of stability in British civilisation,—that the
country is lovelier than the loveliest poetry that ever was written
about it, or ever could be written about it, and that the land and the
life possess an inherent fascination for the inhabitants, that nothing
else could supply, and that no influence can ever destroy or even
seriously disturb. Democracy is rife all over the world, but it will as
soon impede the eternal courses of the stars as it will change the
constitution or shake the social fabric of this realm. "Once more
upon the waters—yet once more!" Soon upon the stormy billows of
Lorn I shall see these lovely shores fade in the distance. Soon,
merged again in the strife and tumult of the commonplace world, I
shall murmur, with as deep a sorrow as the sad strain itself
expresses, the tender words of Scott:

"Glenorchy's proud mountains,


Kilchurn and her towers,
Glenstrae and Glenlyon
No longer are ours."

Corbel from "St. Giles."


CHAPTER XIX
THE HEART OF SCOTLAND
"The Heart of Scotland, Britain's other eye."—Ben Jonson
dinburgh, August 24, 1890.—A bright blue sky,
across which many masses of thin white cloud
are borne swiftly on the cool western wind,
bends over the stately city, and all her miles of
gray mansions and spacious, cleanly streets
sparkle beneath it in a flood of summer sunshine.
It is the Lord's Day, and most of the highways are
deserted and quiet. From the top of the Calton Hill you look down
upon hundreds of blue smoke-wreaths curling upward from the
chimneys of the resting and restful town, and in every direction the
prospect is one of opulence and peace. A thousand years of history
are here crystallised within the circuit of a single glance, and while
you gaze upon one of the grandest emblems that the world contains
of a storied and romantic past, you behold likewise a living and
resplendent pageant of the beauty of to-day. Nowhere else are the
Past and the Present so lovingly blended. There, in the centre,
towers the great crown of St. Giles. Hard by are the quaint slopes of
the Canongate,—teeming with illustrious, or picturesque, or terrible
figures of Long Ago. Yonder the glorious Castle Crag looks
steadfastly westward,—its manifold, wonderful colours continuously
changing in the changeful daylight. Down in the valley Holyrood,
haunted by a myriad of memories and by one resplendent face and
entrancing presence, nestles at the foot of the giant Salisbury Crag;
while the dark, rivened peak of Arthur's Seat rears itself supremely
over the whole stupendous scene. Southward and westward, in the
distance, extends the bleak range of the Pentland Hills; eastward the
cone of Berwick Law and the desolate Bass Rock seem to cleave the
sea; and northward, beyond the glistening crystal of the Forth,—with
the white lines of embattled Inchkeith like a diamond on its bosom,
—the lovely Lomonds, the virginal mountain breasts of Fife, are
bared to the kiss of heaven. It is such a picture as words can but
faintly suggest; but when you look upon it you readily comprehend
the pride and the passion with which a Scotsman loves his native
land.
Dr. Johnson named
Edinburgh as "a city
too well known to
admit description."
That judgment was
proclaimed more
than a hundred years
ago,—before yet
Caledonia had
bewitched the
world's heart as the
haunted land of
Robert Burns and
Walter Scott,—and if
it were true then it is
all the more true
now. But while the
reverent pilgrim
along the ancient
highways of history
may not wisely
attempt description,
which would be
superfluous, he
perhaps may usefully
indulge in brief
chronicle and
impression,—for The Crown of St. Giles's.
these sometimes
prove suggestive to minds that are kindred with his own. Hundreds
of travellers visit Edinburgh, but it is one thing to visit and another
thing to see; and every suggestion, surely, is of value that helps to
clarify our vision. This capital is not learned by driving about in a
cab; for Edinburgh to be truly seen and comprehended must be seen
and comprehended as an exponent of the colossal individuality of
the Scottish character; and therefore it must be observed with
thought. Here is no echo and no imitation. Many another provincial
city of Britain is a miniature copy of London; but the quality of
Edinburgh is her own. Portions of her architecture do indeed denote
a reverence for ancient Italian models, while certain other portions
reveal the influence of the semi-classical taste that prevailed in the
time of the Regent, afterwards George the Fourth. The democratic
tendency of this period,—expressing itself here precisely as it does
everywhere else, in button-making pettiness and vulgar
commonplace,—is likewise sufficiently obvious. Nevertheless, in
every important detail of Edinburgh and of its life, the reticent,
resolute, formidable, impetuous, passionate character of the Scottish
race is conspicuous and predominant. Much has been said against
the Scottish spirit,—the tide of cavil purling on from Dr. Johnson to
Sydney Smith. Dignity has been denied to it, and so has
magnanimity, and so has humour; but there is no audience more
quick than the Scottish audience to respond either to pathos or to
mirth; there is no literature in the world so musically, tenderly, and
weirdly poetical as the Scottish literature; there is no place on earth
where the imaginative instinct of the national mind has resisted, as it
has resisted in Scotland, the encroachment of utility upon the
domain of romance; there is no people whose history has excelled
that of Scotland in the display of heroic, intellectual, and moral
purpose, combined with passionate sensibility; and no city could
surpass the physical fact of Edinburgh as a manifestation of broad
ideas, unstinted opulence, and grim and rugged grandeur.
Whichever way you turn, and whatever object you behold, that
consciousness is always present to your thought,—the consciousness
of a race of beings intensely original, individual, passionate,
authoritative, and magnificent.
Scott's House in Edinburgh.

The capital of Scotland is not only beautiful but eloquent. The


present writer does not assume to describe it, or to instruct the
reader concerning it, but only to declare that at every step the
sensitive mind is impressed with the splendid intellect, the individual
force, and the romantic charm of the Scottish character, as it is
commemorated and displayed in this delightful place. What a wealth
of significance it possesses may be indicated by even the most
meagre record and the most superficial commentary upon the
passing events of a traveller's ordinary day. The greatest name in
the literature of Scotland is Walter Scott. He lived and laboured for
twenty-four years in the modest three-story, gray stone house which
is No. 39 Castle street. It has been my privilege to enter that house,
and to stand in the room in which Scott began the novel of
Waverley. Many years roll backward under the spell of such an
experience, and the gray-haired man is a boy again, with all the
delights of the Waverley Novels before him, health shining in his
eyes, and joy beating in his heart, as he looks onward through vistas
of golden light into a paradise of fadeless flowers and of happy
dreams. The room that was Scott's study is a small one, on the first
floor, at the back, and is lighted by one large window, opening
eastward, through which you look upon the rear walls of sombre,
gray buildings, and upon a small slope of green lawn, in which is the
unmarked grave of one of Sir Walter's dogs. "The misery of keeping
a dog," he once wrote, "is his dying so soon; but, to be sure, if he
lived for fifty years and then died, what would become of me?" My
attention was called to a peculiar fastening on the window of the
study,—invented and placed there by Scott himself,—so arranged
that the sash can be safely kept locked when raised a few inches
from the sill. On the south side of the room is the fireplace, facing
which he would sit as he wrote, and into which, of an evening, he
has often gazed, hearing meanwhile the moan of the winter wind,
and conjuring up, in the blazing brands, those figures of brave
knights and gentle ladies that were to live forever in the amber of
his magical art. Next to the study, on the same floor, is the larger
apartment that was his dining-room, where his portrait of
Claverhouse, now at Abbotsford, once hung above the mantel, and
where so many of the famous people of the past enjoyed his
hospitality and his talk. On the south wall of this room now hang two
priceless autograph letters, one of them in the handwriting of Scott,
the other in that of Burns. Both rooms are used for business offices
now,—the house being tenanted by the agency of the New Zealand
Mortgage Company,—and both are furnished with large presses, for
the custody of deeds and family archives. Nevertheless these rooms
remain much as they were when Scott lived in them, and his spirit
seems to haunt the place. I was brought very near to him that day,
for in the same hour was placed in my hands the original manuscript
of his Journal, and I saw, in his handwriting, the last words that ever
fell from his pen. That Journal is in two quarto volumes. One of
them is filled with writing; the other half filled; and the lines in both
are of a fine, small character, crowded closely together. Toward the
last the writing manifests only too well the growing infirmity of the
broken Minstrel,—the forecast of the hallowed deathbed of
Abbotsford and the venerable and glorious tomb of Dryburgh. These
are his last words: "We slept reasonably, but on the next morning"—
and so the Journal abruptly ends. I can in no way express the
emotion with which I looked upon those feebly scrawled syllables,—
the last effort of the nerveless hand that once had been strong
enough to thrill the heart of all the world. The Journal has been
lovingly and carefully edited by David Douglas, whose fine taste and
great gentleness of nature, together with his ample knowledge of
Scottish literature and society, eminently qualify him for the
performance of this sacred duty; and the world will possess this
treasure and feel the charm of its beauty and pathos,—which is the
charm of a great nature expressed in its perfect simplicity; but the
spell that is cast upon the heart and the imagination by a prospect
of the actual handwriting of Sir Walter Scott, in the last words that
he wrote, cannot be conveyed in print.
From the house in Castle street I went to the rooms of the Royal
Society, where there is a portrait of Scott, by John Graham Gilbert,
more lifelike,—being representative of his soul as well as his face
and person,—than any other that is known. It hangs there, in
company with other paintings of former presidents of this institution,
—notably one of Sir David Brewster and one of James Watt,—in the
hall in which Sir Walter often sat, presiding over the deliberations
and literary exercises of his
comrades in scholarship
and art. In another hall I
saw a pulpit in which John
Knox used to preach, in
the old days of what Dr.
Johnson expressively
called "The ruffians of
Reformation," and hard by
was "The Maiden," the
terrible Scottish guillotine,
with its great square knife,
set in a thick weight of
lead, by which the grim
Regent Morton was slain,
in 1581, the Marquis of
Argyle, in 1661, and the
gallant, magnanimous,
devoted Earl of Argyle, in
1685,—one more sacrifice The Maiden.
to the insatiate House of
Stuart. This monster has
drunk the blood of many a noble gentleman, and there is a weird,
sinister suggestion of gratified ferocity and furtive malignity in its
rude, grisly, uncanny fabric of blackened timbers. You may see, in
the quaint little panelled chapel of St. Mary Magdalene, in the
Cowgate, not distant from the present abode of the sanguinary
Maiden,—brooding over her hideous consummation of slaughter and
misery,—the place where the mangled body of the heroic Argyle
was laid, in secret sanctuary, for several nights after that scene of
piteous sacrifice at the old Market Cross; and when you walk in the
solemn enclosure of the Grayfriars church,—so fitly styled, by Sir
Walter, The Westminster Abbey of Scotland,—your glance will fall
upon a sunken pillar, low down upon the northern slope of that
haunted, lamentable ground, which bears the letters "I. M.," and
which marks the grave of the baleful Morton, whom the Maiden
decapitated, for his share in the murder of Rizzio. In these old cities
there is no keeping away from sepulchres. "The paths of glory," in
every sense, "lead but to the grave." George Buchanan and Allan
Ramsay, poets whom no literary pilgrim will neglect, rest in this
churchyard, though the exact places of their interment are not
positively denoted, and here, likewise, rest the elegant historian
Robertson, and "the Addison of Scotland," Henry Mackenzie. The
building in the High street in which Allan Ramsay once had his abode
and his bookshop, and in which he wrote his pastoral of The Gentle
Shepherd, is occupied now by a barber; but, since he is one that
scorns not to proclaim over his door, in mighty letters, the poetic
lineage of his dwelling, it seems not amiss that this haunt of the
Muses should have fallen into such lowly hands. Of such a character,
hallowed with associations that pique the fancy and touch the heart,
are the places and the names that an itinerant continually
encounters in his rambles in Edinburgh.

Grayfriars Church.
High Street—Allan Ramsay's Shop.

The pilgrim could muse for many an hour over the little Venetian
mirror[50] that hangs in the bedroom of Mary Stuart, in Holyrood
Palace. What faces and what scenes it must have reflected! How
often her own beautiful countenance and person,—the dazzling
eyes, the snowy brow, the red gold hair, the alabaster bosom,—may
have blazed in its crystal depths, now tarnished and dim, like the
record of her own calamitous and wretched days! Did those lovely
eyes look into this mirror, and was their glance scared and
tremulous, or fixed and terrible, on that dismal February night, so
many years ago, when the fatal explosion in the Kirk o' Field
resounded with an echo that has never died away? Who can tell?
This glass saw the gaunt and livid face of Ruthven, when he led his
comrades of murder into that royal chamber, and it beheld Rizzio,
screaming in mortal terror, as he was torn from the skirts of his
mistress and savagely slain before her eyes. Perhaps, also, when
that hideous episode was over and done with, it saw Queen Mary
and her despicable husband the next time they met, and were alone
together, in that ghastly room. "It shall be dear blood to some of
you," the queen had said, while the murder of Rizzio was doing.
Surely, having so injured a woman, any man with eyes to see might
have divined his fate, in the perfect calm of her heavenly face and
the smooth tones of her gentle voice, at such a moment as that. "At
the fireside tragedies are acted,"—and tragic enough must have
been the scene of that meeting, apart from human gaze, in the
chamber of crime and death. No other relic of Mary Stuart stirs the
imagination as that mirror does,—unless, perhaps, it be the little
ebony crucifix, once owned and reverenced by Sir Walter Scott and
now piously treasured at Abbotsford, which she held in her
hands when she went to her death, in the hall of Fotheringay Castle.
The Canongate.

Holyrood Palace, in Mary Stuart's time, was not of its present


shape. The tower containing her rooms was standing, and from that
tower the building extended eastward to the abbey, and then it
veered to the south. Much of the building was destroyed by fire in
1544, and again in Cromwell's time, but both church and palace
were rebuilt. The entire south side, with its tower that looks directly
towards the crag, was added in the later period of Charles the
Second. The furniture in Mary Stuart's room is partly spurious, but
the rooms are genuine. Musing thus, and much striving to
reconstruct those strange scenes of the past, in which that beautiful,
dangerous woman bore so great a part, the pilgrim strolls away into
the Canongate,—once clean and elegant, now squalid and noisome,
—and still the storied figures of history walk by his side or come to
meet him at every close and wynd. John Knox, Robert Burns, Tobias
Smollett, David Hume, Dugald Stuart, John Wilson, Hugh Miller, Gay,
led onward by the blithe and gracious Duchess of Queensberry, and
Dr. Johnson, escorted by the affectionate and faithful James Boswell,
the best biographer that ever lived,—these and many more, the
lettered worthies of long ago, throng into this haunted street and
glorify it with the rekindled splendours of other days. You cannot be
lonely here. This it is that makes the place so eloquent and so
precious. For what did those men live and labour? To what were
their shining talents and wonderful forces devoted? To the
dissemination of learning; to the emancipation of the human mind
from the bondage of error; to the ministry of the beautiful,—and
thus to the advancement of the human race in material comfort, in
gentleness of thought, in charity of conduct, in refinement of
manners, and in that spiritual exaltation by which, and only by
which, the true progress of mankind is at once accomplished and
proclaimed.
HOLYROOD CASTLE
AND
ARTHUR'S SEAT

But the dark has come, and this Edinburgh ramble shall end with
the picture that closed its own magnificent day. You are standing on
the rocky summit of Arthur's Seat. From that superb mountain peak
your gaze takes in the whole capital, together with the country in
every direction for many miles around. The evening is uncommonly
clear. Only in the west dense masses of black cloud are thickly piled
upon each other, through which the sun is sinking, red and sullen
with menace of the storm. Elsewhere and overhead the sky is
crystal, and of a pale, delicate blue. A cold wind blows briskly from
the east and sweeps a million streamers of white smoke in turbulent
panic over the darkening roofs of the city, far below. In the north the
lovely Lomond Hills are distinctly visible across the dusky level of the
Forth, which stretches away toward the ocean, one broad sheet of
glimmering steel,—its margin indented with many a graceful bay,
and the little islands that adorn it shining like stones of amethyst set
in polished flint. A few brown sails are visible, dotting the waters,
and far to the east appears the graceful outline of the Isle of May,—
which was the shrine of the martyred St. Adrian,—and the lonely,
wave-beaten Bass Rock, with its millions of seagulls and solan-
geese. Busy Leith and picturesque Newhaven and every little
village on the coast is sharply defined in the frosty light. At your
feet is St. Leonards, with the tiny cottage of Jeanie Deans. Yonder, in
the south, are the gray ruins of Craigmillar Castle, once the favourite
summer home of the Queen of Scots, now open to sun and rain,
moss-grown and desolate, and swept by every wind that blows.
More eastward the eye lingers upon Carberry Hill, where Mary
surrendered herself to her nobles, just before the romantic episode
of Loch Leven Castle; and far beyond that height the sombre fields,
intersected by green hawthorn hedges and many-coloured with the
various hues of pasture and harvest, stretch away to the hills of
Lammermoor and the valleys of Tweed and Esk. Darker and darker
grow the gathering shadows of the gloaming. The lights begin to
twinkle in the city streets. The echoes of the rifles die away in the
Hunter's Bog. A piper far off is playing the plaintive music of The
Blue Bells of Scotland. And as your steps descend the crag, the
rising moon, now nearly at the full, shines through the gauzy mist
and hangs above the mountain like a shield of gold upon the
towered citadel of night.
St. Giles's, from the Lawn Market.
CHAPTER XX
SIR WALTER SCOTT
ore than a century has passed since Walter Scott
was born—a poet destined to exercise a
profound, far-reaching, permanent influence
upon the feelings of the human race, and thus to
act a conspicuous part in its moral and spiritual
development and guidance. To the greatness of
his mind, the nobility of his spirit, and the beauty of his life there is
abundant testimony in his voluminous and diversified writings, and
in his ample and honest biography. Everybody who reads has read
something from the pen of Scott, or something commemorative of
him, and in every mind to which his name is known it is known as
the synonym of great faculties and wonderful achievement. There
must have been enormous vitality of spirit, prodigious power of
intellect, irresistible charm of personality, and lovable purity of moral
nature in the man whom thousands that never saw him living,—men
and women of a later age and different countries,—know and
remember and love as Sir Walter Scott. Others have written greatly.
Milton, Dryden, Addison, Pope, Cowper, Johnson, Byron, Shelley,
Wordsworth, Coleridge, Landor,—these are only a few of the imperial
names that cannot die. But these names live in the world's respect.
The name of Scott lives also in its affection. What other name of the
past in English literature,—unless it be that of Shakespeare,—
arouses such a deep and sweet feeling of affectionate interest,
gentle pleasure, gratitude, and reverential love?
The causes of Sir Walter Scott's ascendency are to be found in the
goodness of his heart; the integrity of his conduct; the romantic and
picturesque accessories and atmosphere of his life; the fertile
brilliancy of his literary execution; the charm that he exercises, both
as man and artist, over the imagination; the serene, tranquillising
spirit of his works;
and, above all, the
buoyancy, the happy
freedom, of his
genius. He was not
simply an intellectual
power; he was also a
human and gentle
comforter. He
wielded an immense
mental force, but he
always wielded it for
good, and always
with tenderness. It is
impossible to
conceive of his ever
having done a wrong
act, or of any contact
with his influence
that would not
inspire the wish to be
virtuous and noble.
Sir Walter Scott. The scope of his
sympathy was as
broad as the
weakness and the need are of the human race. He understood the
hardship, the dilemma, in the moral condition of mankind: he wished
people to be patient and cheerful, and he tried to make them so. His
writings are full of sweetness and cheer, and they contain nothing
that is morbid,—nothing that tends toward surrender and misery. He
did not sequester himself in mental pride, but simply and sturdily,
through years of conscientious toil, he employed the faculties of a
strong, tender, gracious genius for the good of his fellow-creatures.
The world loves him because he is worthy to be loved, and because
he has lightened the burden of its care and augmented the sum of
its happiness.
Certain differences and confusions of opinion have arisen from the
consideration of his well-known views as to the literary art, together
with his equally well-known ambition to take and to maintain the
rank and estate of a country squire. As an artist he had ideals that
he was never able to fulfil. As a man, and one who was influenced
by imagination, taste, patriotism, family pride, and a profound belief
in established monarchical institutions, it was natural that he should
wish to found a grand and beautiful home for himself and his
posterity. A poet is not the less a poet because he thinks modestly of
his writings and practically knows and admits that there is something
else in the world beside literature; or because he happens to want
his dinner and a roof to cover him. In trying to comprehend a great
man, a good method is to look at his life as a whole, and not to
deduce petty inferences from the distorted interpretation of petty
details. Sir Walter Scott's conduct of life, like the character out of
which it sprang, was simple and natural. In all that he did you may
perceive the influence of imagination acting upon the finest reason;
the involuntary consciousness of reserve power; habitual deference
to the voice of duty; an aspiring and picturesque plan of artistic
achievement and personal distinction; and deep knowledge of the
world. If ever there was a man who lived to be and not to seem,
that man was Sir Walter Scott. He made no pretensions. He claimed
nothing, but he simply and earnestly earned all. His means were the
oldest and the best; self-respect, hard work, and fidelity to duty. The
development of his nature was slow, but it was thorough and it was
salutary. He was not hampered by precocity and he was not spoiled
by conceit. He acted according to himself, honouring his individuality
and obeying the inward monitor of his genius. But, combined with
the delicate instinct of a gentleman, he had the wise insight,
foresight, and patience of a philosopher; and therefore he respected
the individuality of others, the established facts of life, and the
settled conventions of society. His mind was neither embittered by
revolt nor sickened by delusion. Having had the good fortune to be
born in a country in which a right plan of government prevails,—the
idea of the family, the idea of the strong central power at the head,
with all other powers subordinated to it,—he felt no impulse toward
revolution, no desire to regulate all things anew; and he did not
suffer perturbation from the feverish sense of being surrounded with
uncertainty and endangered by exposure to popular caprice. During
the period of immaturity, and notwithstanding physical weakness
and pain, his spirit was kept equable and cheerful, not less by the
calm environment of a permanent civilisation than by the clearness
of his perceptions and the sweetness of his temperament. In
childhood and youth he endeared himself to all who came near him,
winning affection by inherent goodness and charm. In riper years
that sweetness was reinforced by great sagacity, which took broad
views of individual and social life; so that both by knowledge and by
impulse he was a serene and happy man.
The quality that first impresses the student of the character and
the writings of Sir Walter Scott is truthfulness. He was genuine.
Although a poet, he suffered no torment from vague aspirations.
Although once, and miserably, a disappointed lover, he permitted no
morbid repining. Although the most successful author of his time, he
displayed no egotism. To the end of his days he was frank and
simple,—not indeed sacrificing the reticence of a dignified, self-
reliant nature, but suffering no blight from success, and wearing
illustrious honours with spontaneous, unconscious grace. This
truthfulness, the consequence and the sign of integrity and of great
breadth of intellectual vision, moulded Sir Walter Scott's ambition
and stamped the practical results of his career. A striking illustration
of this is seen in his first adventure in literature. The poems
originally sprang from the spontaneous action of the poetic impulse
and faculty; but they were put forth modestly, in order that the
author might guide himself according to the response of the public
mind. He knew that he might fail as an author, but for failure of that
sort, although he was intensely ambitious, he had no dread. There
would always remain to him the career of private duty and the life of
a gentleman. This view of him gives the key to his character and
explains his conduct. Neither amid the experimental vicissitudes of
his youth, nor amid the labours, achievements, and splendid
honours of his manhood, did he ever place the imagination above
the conscience, or brilliant writing above virtuous living, or art and
fame above morality and religion. "I have been, perhaps, the most
voluminous author of the day," he said, toward the close of his life;
"and it is a comfort to me to think that I have tried to unsettle no
man's faith, to corrupt no man's principles, and that I have written
nothing which, on my deathbed, I should wish blotted." When at last
he lay upon that deathbed the same thought animated and
sustained him. "My dear," he said, to Lockhart, "be a good man, be
virtuous, be religious—be a good man. Nothing else will give you any
comfort when you come to lie here." The mind which thus habitually
dwelt upon goodness as the proper object of human ambition and
the chief merit of human life was not likely to vaunt itself on its
labours or to indulge any save a modest and chastened pride in its
achievements.
Edinburgh Castle.

And this view of him explains the affectionate reverence with


which the memory of Sir Walter Scott is cherished. He was pre-
eminently a type of the greatness that is associated with virtue. But
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like