100% found this document useful (1 vote)
30 views

(eBook PDF) A Guide to Algorithm Design: Paradigms, Methods, and Complexity Analysis instant download

A Guide to Algorithm Design: Paradigms, Methods, and Complexity Analysis provides a comprehensive overview of algorithmic complexity and problem-solving techniques. The book emphasizes understanding algorithmic thinking and includes a variety of examples, exercises, and case studies to illustrate key concepts. It serves as a valuable resource for graduate students and researchers in computer science and engineering.

Uploaded by

venoramonon
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
100% found this document useful (1 vote)
30 views

(eBook PDF) A Guide to Algorithm Design: Paradigms, Methods, and Complexity Analysis instant download

A Guide to Algorithm Design: Paradigms, Methods, and Complexity Analysis provides a comprehensive overview of algorithmic complexity and problem-solving techniques. The book emphasizes understanding algorithmic thinking and includes a variety of examples, exercises, and case studies to illustrate key concepts. It serves as a valuable resource for graduate students and researchers in computer science and engineering.

Uploaded by

venoramonon
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/ 55

(eBook PDF) A Guide to Algorithm Design:

Paradigms, Methods, and Complexity Analysis


download

https://ebookluna.com/product/ebook-pdf-a-guide-to-algorithm-
design-paradigms-methods-and-complexity-analysis/

Download more ebook from https://ebookluna.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookluna.com
to discover even more!

(eBook PDF) Research Methods, Design, and Analysis 13th Edition

https://ebookluna.com/product/ebook-pdf-research-methods-design-and-
analysis-13th-edition/

(eBook PDF) Algorithm Design by Jon Kleinberg

https://ebookluna.com/product/ebook-pdf-algorithm-design-by-jon-kleinberg/

(Original PDF) Algorithm Design and Applications by Michael T. Goodrich

https://ebookluna.com/product/original-pdf-algorithm-design-and-
applications-by-michael-t-goodrich/

Modern Control: State-Space Analysis and Design Methods 1st Edition - eBook
PDF

https://ebookluna.com/download/modern-control-state-space-analysis-and-
design-methods-ebook-pdf/
(eBook PDF) Handbook of Research Methods in Complexity Science: Theory and
Applications

https://ebookluna.com/product/ebook-pdf-handbook-of-research-methods-in-
complexity-science-theory-and-applications/

(eBook PDF) Data Structures & Algorithm Analysis in C++ 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-algorithm-analysis-
in-c-4th-edition/

Data Structures & Algorithm Analysis in C++ 4th Edition (eBook PDF)

https://ebookluna.com/product/data-structures-algorithm-analysis-in-c-4th-
edition-ebook-pdf/

(eBook PDF) Qualitative Psychology: A Practical Guide to Research Methods


3rd Edition

https://ebookluna.com/product/ebook-pdf-qualitative-psychology-a-practical-
guide-to-research-methods-3rd-edition/

(eBook PDF) Research Design and Methods: A Process Approach 11th Edition

https://ebookluna.com/product/ebook-pdf-research-design-and-methods-a-
process-approach-11th-edition/
Computer Science/Computer Engineering/Computing Chapman & Hall/CRC
Applied Algorithms and Data Structures Series

ALGORITHM DESIGN
“This book is a great technical arsenal for every graduate student and post-
graduate researcher. By providing a treasure trove of concrete algorithmic A GUIDE TO
ALGORITHM
examples, the book trains the reader to recognize clues that indicate the
complexity of a broad range of algorithmic problems, while supplying

A GUIDE TO
a battery of techniques for solving a particular problem in hand. …”
—Umit Catalyurek, Professor, Ohio State University

“This book is unique among texts on algorithmics in its emphasis on how


to ‘think algorithmically’ rather than just how to solve specific (classes of)
DESIGN
algorithmic problems. The authors skillfully engage the reader in a journey Paradigms, Methods, and Complexity Analysis
of algorithmic self-discovery as they cover a broad spectrum of issues …
I shall be very happy to have this text on my bookshelf as a reference on
methods as well as results.”
—Arnold L. Rosenberg, Research Professor, Northeastern University, and
Distinguished University Professor Emeritus, University of Massachusetts
Amherst

“This book presents a well-balanced approach to theory and algorithms


and introduces difficult concepts using rich motivating examples. It
demonstrates the applicability of fundamental principles and analysis
techniques to practical problems facing computer scientists and engineers.
You do not have to be a theoretician to enjoy and learn from this book.”
—Rami Melhem, Professor of Computer Science, University of Pittsburgh

Presenting a complementary perspective to standard books on algorithms,


A Guide to Algorithm Design: Paradigms, Methods, and Complexity

Benoit, Robert,
Analysis provides a roadmap for readers to determine the difficulty of an

and
algorithmic problem by finding an optimal solution or proving complexity
results. It gives a practical treatment of algorithmic complexity and guides Vivien
readers in solving algorithmic problems. The book offers a comprehensive
set of problems with solutions as well as in-depth case studies that
demonstrate how to assess the complexity of a new problem.

Anne Benoit, Yves Robert,


K11226 and Frédéric Vivien

K11226_Cover.indd 1 5/31/13 9:17 AM


vii

Solution to Exercise 3.5: Scheduling independent tasks with


deadlines . . . . . . . . . . . . . . . . . . . . . . . . . 73
Solution to Exercise 3.6: Edge matroids . . . . . . . . . . . . 74
Solution to Exercise 3.7: Huffman code . . . . . . . . . . . . . 75
3.7 Bibliographical notes . . . . . . . . . . . . . . . . . . . . . . 79

4 Dynamic programming 81
4.1 The coin changing problem . . . . . . . . . . . . . . . . . . . 81
4.2 The knapsack problem . . . . . . . . . . . . . . . . . . . . . 84
4.3 Designing dynamic-programming algorithms . . . . . . . . . 86
4.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Exercise 4.1: Matrix chains . . . . . . . . . . . . . . . . . . . 87
Exercise 4.2: The library . . . . . . . . . . . . . . . . . . . . . 88
Exercise 4.3: Polygon triangulation . . . . . . . . . . . . . . . 88
Exercise 4.4: Square of ones . . . . . . . . . . . . . . . . . . . 89
Exercise 4.5: The wind band . . . . . . . . . . . . . . . . . . 89
Exercise 4.6: Ski rental . . . . . . . . . . . . . . . . . . . . . . 89
Exercise 4.7: Building set . . . . . . . . . . . . . . . . . . . . 90
4.5 Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . 90
Solution to Exercise 4.1: Matrix chains . . . . . . . . . . . . . 90
Solution to Exercise 4.2: The library . . . . . . . . . . . . . . 91
Solution to Exercise 4.3: Polygon triangulation . . . . . . . . 93
Solution to Exercise 4.4: Square of ones . . . . . . . . . . . . 96
Solution to Exercise 4.5: The wind band . . . . . . . . . . . . 98
Solution to Exercise 4.6: Ski rental . . . . . . . . . . . . . . . 98
Solution to Exercise 4.7: Building set . . . . . . . . . . . . . . 102
4.6 Bibliographical notes . . . . . . . . . . . . . . . . . . . . . . 103

5 Amortized analysis 105


5.1 Methods for amortized analysis . . . . . . . . . . . . . . . . . 105
5.1.1 Running examples . . . . . . . . . . . . . . . . . . . . 105
5.1.2 Aggregate analysis . . . . . . . . . . . . . . . . . . . . 106
5.1.3 Accounting method . . . . . . . . . . . . . . . . . . . 106
5.1.4 Potential method . . . . . . . . . . . . . . . . . . . . . 107
5.2 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Exercise 5.1: Binary counter . . . . . . . . . . . . . . . . . . . 108
Exercise 5.2: Inserting and deleting . . . . . . . . . . . . . . . 108
Exercise 5.3: Stack . . . . . . . . . . . . . . . . . . . . . . . . 109
Exercise 5.4: Deleting half the elements . . . . . . . . . . . . 109
Exercise 5.5: Searching and inserting . . . . . . . . . . . . . . 109
Exercise 5.6: Splay trees . . . . . . . . . . . . . . . . . . . . . 110
Exercise 5.7: Half perimeter of a polygon . . . . . . . . . . . 112
5.3 Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . 112
Solution to Exercise 5.1: Binary counter . . . . . . . . . . . . 112
Solution to Exercise 5.2: Inserting and deleting . . . . . . . . 113

© 2014 by Taylor & Francis Group, LLC


viii

Solution to Exercise 5.3: Stack . . . . . . . . . . . . . . . . . 114


Solution to Exercise 5.4: Deleting half the elements . . . . . . 115
Solution to Exercise 5.5: Searching and inserting . . . . . . . 116
Solution to Exercise 5.6: Splay trees . . . . . . . . . . . . . . 117
Solution to Exercise 5.7: Half perimeter of a polygon . . . . . 119
5.4 Bibliographical notes . . . . . . . . . . . . . . . . . . . . . . 122

II NP-completeness and beyond 123


6 NP-completeness 125
6.1 A practical approach to complexity theory . . . . . . . . . . 125
6.2 Problem classes . . . . . . . . . . . . . . . . . . . . . . . . . 126
6.2.1 Problems in P . . . . . . . . . . . . . . . . . . . . . . 127
6.2.2 Problems in NP . . . . . . . . . . . . . . . . . . . . . 129
6.3 NP-complete problems and reduction theory . . . . . . . . . 132
6.3.1 Polynomial reduction . . . . . . . . . . . . . . . . . . 132
6.3.2 Cook’s theorem . . . . . . . . . . . . . . . . . . . . . . 133
6.3.3 Growing the class NPC of NP-complete problems . . . 134
6.3.4 Optimization problems versus decision problems . . . 135
6.4 Examples of NP-complete problems and reductions . . . . . 136
6.4.1 3-SAT . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
6.4.2 CLIQUE . . . . . . . . . . . . . . . . . . . . . . . . . 138
6.4.3 VERTEX-COVER . . . . . . . . . . . . . . . . . . . . 139
6.4.4 Scheduling problems . . . . . . . . . . . . . . . . . . . 140
6.4.5 Other famous NP-complete problems . . . . . . . . . . 142
6.5 Importance of problem definition . . . . . . . . . . . . . . . . 143
6.6 Strong NP-completeness . . . . . . . . . . . . . . . . . . . . 145
6.7 Why does it matter? . . . . . . . . . . . . . . . . . . . . . . 146
6.8 Bibliographical notes . . . . . . . . . . . . . . . . . . . . . . 146

7 Exercises on NP-completeness 149


7.1 Easy reductions . . . . . . . . . . . . . . . . . . . . . . . . . 149
Exercise 7.1: Wheel . . . . . . . . . . . . . . . . . . . . . . . 149
Exercise 7.2: Knights of the round table . . . . . . . . . . . . 149
Exercise 7.3: Variants of CLIQUE . . . . . . . . . . . . . . . 149
Exercise 7.4: Path with vertex pairs . . . . . . . . . . . . . . 150
Exercise 7.5: VERTEX-COVER with even degrees . . . . . . 150
Exercise 7.6: Around 2-PARTITION . . . . . . . . . . . . . . 150
7.2 About graph coloring . . . . . . . . . . . . . . . . . . . . . . 151
Exercise 7.7: COLOR . . . . . . . . . . . . . . . . . . . . . . 151
Exercise 7.8: 3-COLOR . . . . . . . . . . . . . . . . . . . . . 151
Exercise 7.9: 3-COLOR-PLAN . . . . . . . . . . . . . . . . . 152
7.3 Scheduling problems . . . . . . . . . . . . . . . . . . . . . . . 152
Exercise 7.10: Scheduling independent tasks with p processors 152

© 2014 by Taylor & Francis Group, LLC


ix

Exercise 7.11: Scheduling with two processors . . . . . . . . . 152


7.4 More involved reductions . . . . . . . . . . . . . . . . . . . . 153
Exercise 7.12: Transitive subchain . . . . . . . . . . . . . . . 153
Exercise 7.13: INDEPENDENT SET . . . . . . . . . . . . . . 153
Exercise 7.14: DOMINATING SET . . . . . . . . . . . . . . . 153
Exercise 7.15: Carpenter . . . . . . . . . . . . . . . . . . . . . 153
Exercise 7.16: k-center . . . . . . . . . . . . . . . . . . . . . . 153
Exercise 7.17: Variants of 3-SAT . . . . . . . . . . . . . . . . 154
Exercise 7.18: Variants of SAT . . . . . . . . . . . . . . . . . 154
7.5 2-PARTITION is NP-complete . . . . . . . . . . . . . . . . . 155
Exercise 7.19: SUBSET-SUM . . . . . . . . . . . . . . . . . . 155
Exercise 7.20: NP-completeness of 2-PARTITION . . . . . . 155
7.6 Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . 155
Solution to Exercise 7.1: Wheel . . . . . . . . . . . . . . . . . 156
Solution to Exercise 7.2: Knights of the round table . . . . . 156
Solution to Exercise 7.3: Variants of CLIQUE . . . . . . . . . 157
Solution to Exercise 7.4: Path with vertex pairs . . . . . . . . 158
Solution to Exercise 7.5: VERTEX-COVER with even degrees 158
Solution to Exercise 7.6: Around 2-PARTITION . . . . . . . 159
Solution to Exercise 7.7: COLOR . . . . . . . . . . . . . . . . 160
Solution to Exercise 7.8: 3-COLOR . . . . . . . . . . . . . . . 162
Solution to Exercise 7.9: 3-COLOR-PLAN . . . . . . . . . . . 163
Solution to Exercise 7.10: Scheduling independent tasks with
p processors . . . . . . . . . . . . . . . . . . . . . . . . 166
Solution to Exercise 7.11: Scheduling with two processors . . 166
Solution to Exercise 7.12: Transitive subchain . . . . . . . . . 167
Solution to Exercise 7.13: INDEPENDENT SET . . . . . . . 168
Solution to Exercise 7.14: DOMINATING SET . . . . . . . . 169
Solution to Exercise 7.15: Carpenter . . . . . . . . . . . . . . 170
Solution to Exercise 7.16: k-center . . . . . . . . . . . . . . . 171
Solution to Exercise 7.17: Variants of 3-SAT . . . . . . . . . . 172
Solution to Exercise 7.18: Variants of SAT . . . . . . . . . . . 174
Solution to Exercise 7.19: SUBSET-SUM . . . . . . . . . . . 175
Solution to Exercise 7.20: NP-completeness of 2-PARTITION 177
7.7 Bibliographical notes . . . . . . . . . . . . . . . . . . . . . . 178

8 Beyond NP-completeness 179


8.1 Approximation results . . . . . . . . . . . . . . . . . . . . . . 179
8.1.1 Approximation algorithms . . . . . . . . . . . . . . . . 180
8.1.2 Vertex cover . . . . . . . . . . . . . . . . . . . . . . . 181
8.1.3 Traveling salesman problem (TSP) . . . . . . . . . . . 182
8.1.4 Bin packing . . . . . . . . . . . . . . . . . . . . . . . . 183
8.1.5 2-PARTITION . . . . . . . . . . . . . . . . . . . . . . 187
8.2 Polynomial problem instances . . . . . . . . . . . . . . . . . 192
8.2.1 Partitioning problems . . . . . . . . . . . . . . . . . . 193

© 2014 by Taylor & Francis Group, LLC


x

8.2.2 Assessing problem complexity . . . . . . . . . . . . . . 194


8.3 Linear programming . . . . . . . . . . . . . . . . . . . . . . . 195
8.3.1 Formal definition . . . . . . . . . . . . . . . . . . . . . 195
8.3.2 Relaxation and rounding . . . . . . . . . . . . . . . . . 197
8.4 Randomized algorithms . . . . . . . . . . . . . . . . . . . . . 200
8.4.1 The algorithm . . . . . . . . . . . . . . . . . . . . . . 201
8.4.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . 201
8.5 Branch-and-bound and backtracking . . . . . . . . . . . . . . 202
8.5.1 Backtracking: The n queens . . . . . . . . . . . . . . . 203
8.5.2 Branch-and-bound: The knapsack . . . . . . . . . . . 204
8.5.3 Graph algorithms . . . . . . . . . . . . . . . . . . . . . 206
8.6 Bibliographical notes . . . . . . . . . . . . . . . . . . . . . . 209

9 Exercises going beyond NP-completeness 211


9.1 Approximation results . . . . . . . . . . . . . . . . . . . . . . 211
Exercise 9.1: Single machine scheduling . . . . . . . . . . . . 211
Exercise 9.2: SUBSET-SUM . . . . . . . . . . . . . . . . . . . 212
Exercise 9.3: SET-COVER . . . . . . . . . . . . . . . . . . . 213
Exercise 9.4: VERTEX-COVER . . . . . . . . . . . . . . . . 213
Exercise 9.5: Scheduling independent tasks in parallel . . . . 215
Exercise 9.6: Point clustering . . . . . . . . . . . . . . . . . . 215
Exercise 9.7: k-center . . . . . . . . . . . . . . . . . . . . . . 216
Exercise 9.8: Knapsack . . . . . . . . . . . . . . . . . . . . . . 217
9.2 Dealing with NP-complete problems . . . . . . . . . . . . . . 218
Exercise 9.9: Mixed integer linear program for replica place-
ment . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Exercise 9.10: A randomized algorithm for independent set . 218
Exercise 9.11: Branch-and-bound applied to MAX-SAT . . . 219
9.3 Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . 219
Solution to Exercise 9.1: Single machine scheduling . . . . . . 219
Solution to Exercise 9.2: SUBSET-SUM . . . . . . . . . . . . 221
Solution to Exercise 9.3: SET-COVER . . . . . . . . . . . . . 223
Solution to Exercise 9.4: VERTEX-COVER . . . . . . . . . . 224
Solution to Exercise 9.5: Scheduling independent tasks in par-
allel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Solution to Exercise 9.6: Point clustering . . . . . . . . . . . 228
Solution to Exercise 9.7: k-center . . . . . . . . . . . . . . . . 229
Solution to Exercise 9.8: Knapsack . . . . . . . . . . . . . . . 231
Solution to Exercise 9.9: Mixed integer linear program for
replica placement . . . . . . . . . . . . . . . . . . . . . 234
Solution to Exercise 9.10: A randomized algorithm for inde-
pendent set . . . . . . . . . . . . . . . . . . . . . . . . 237
Solution to Exercise 9.11: Branch-and-bound applied to MAX-
SAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
9.4 Bibliographical notes . . . . . . . . . . . . . . . . . . . . . . 238

© 2014 by Taylor & Francis Group, LLC


xi

III Reasoning on problem complexity 239


10 Reasoning to assess a problem complexity 241
10.1 Basic reasoning . . . . . . . . . . . . . . . . . . . . . . . . . 241
10.1.1 Polynomial instances . . . . . . . . . . . . . . . . . . . 241
10.1.2 NP-complete instances . . . . . . . . . . . . . . . . . . 242
10.2 Set of problems with polynomial-time algorithms . . . . . . . 243
10.3 Set of NP-complete problems . . . . . . . . . . . . . . . . . . 244
10.3.1 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 245
10.3.2 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . 246

11 Chains-on-chains partitioning 249


11.1 Optimal algorithms for homogeneous resources . . . . . . . . 249
11.1.1 Dynamic-programming algorithm . . . . . . . . . . . . 250
11.1.2 Binary search algorithm . . . . . . . . . . . . . . . . . 250
11.1.3 Improved algorithms . . . . . . . . . . . . . . . . . . . 250
11.2 Variants of the problem . . . . . . . . . . . . . . . . . . . . . 252
11.2.1 Communication costs . . . . . . . . . . . . . . . . . . 252
11.2.2 Chain of heterogeneous resources . . . . . . . . . . . . 253
11.3 Extension to a clique of heterogeneous resources . . . . . . . 254
11.3.1 NP-completeness . . . . . . . . . . . . . . . . . . . . . 254
11.3.2 Practical solutions . . . . . . . . . . . . . . . . . . . . 257
11.3.3 Integer linear program . . . . . . . . . . . . . . . . . . 257
11.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

12 Replica placement in tree networks 261


12.1 Access policies . . . . . . . . . . . . . . . . . . . . . . . . . . 262
12.1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . 262
12.1.2 Impact of the policies on the existence of a solution . 263
12.1.3 Impact of the policies on the cost of a solution . . . . 264
12.2 Complexity results . . . . . . . . . . . . . . . . . . . . . . . . 266
12.2.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . 266
12.2.2 MinNb problem . . . . . . . . . . . . . . . . . . . . . 267
12.2.3 MinCost problem . . . . . . . . . . . . . . . . . . . . 273
12.2.4 Integer linear program . . . . . . . . . . . . . . . . . . 275
12.3 Variants of the replica placement problem . . . . . . . . . . . 279
12.3.1 Enforcing a quality of service . . . . . . . . . . . . . . 280
12.3.2 Power-aware replica placement . . . . . . . . . . . . . 282
12.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286

13 Packet routing 287


13.1 MEDP: Maximum edge-disjoint paths . . . . . . . . . . . . 288
13.1.1 Problem statement . . . . . . . . . . . . . . . . . . . . 288
13.1.2 Naive greedy algorithm . . . . . . . . . . . . . . . . . 289
13.1.3 Short-requests-first greedy algorithm . . . . . . . . . . 291

© 2014 by Taylor & Francis Group, LLC


xii

13.1.4 Inapproximability result . . . . . . . . . . . . . . . . . 292


13.2 PRVP: Packet routing with variable-paths . . . . . . . . . . 294
13.2.1 Problem statement . . . . . . . . . . . . . . . . . . . . 294
13.2.2 Bounding optimal makespan via linear programming . 295
13.2.3 Routing algorithm . . . . . . . . . . . . . . . . . . . . 297
13.2.4 Steady-state approach . . . . . . . . . . . . . . . . . . 300
13.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

14 Matrix product, or tiling the unit square 303


14.1 Problem motivation . . . . . . . . . . . . . . . . . . . . . . . 304
14.2 NP-completeness . . . . . . . . . . . . . . . . . . . . . . . . . 307
14.3 A guaranteed heuristic . . . . . . . . . . . . . . . . . . . . . 311
14.3.1 The ColPeriSum(s) problem . . . . . . . . . . . . . 312
14.3.2 Performance guarantee . . . . . . . . . . . . . . . . . . 316
14.3.3 Looking for a better solution . . . . . . . . . . . . . . 317
14.4 Related problems . . . . . . . . . . . . . . . . . . . . . . . . 320

15 Online scheduling 321


15.1 Flow time optimization . . . . . . . . . . . . . . . . . . . . . 322
15.2 Competitive analysis . . . . . . . . . . . . . . . . . . . . . . 324
15.2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . 324
15.2.2 Method to establish a competitive analysis result . . . 327
15.3 Makespan optimization . . . . . . . . . . . . . . . . . . . . . 334
15.3.1 List scheduling algorithms . . . . . . . . . . . . . . . . 335
15.3.2 Randomized optimization of makespan . . . . . . . . . 338
15.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347

References 349

Index 359

© 2014 by Taylor & Francis Group, LLC


List of exercises

1.1 Longest balanced section . . . . . . . . . . . . . . . . . . . . . 8


1.2 Find the star . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3 Breaking boxes . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4 Maximum of n integers . . . . . . . . . . . . . . . . . . . . . . 10
1.5 Maximum and minimum of n integers . . . . . . . . . . . . . 10
1.6 Maximum and second maximum of n integers . . . . . . . . . 11
1.7 Merging two sorted sets . . . . . . . . . . . . . . . . . . . . . 11
1.8 The toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.9 Sorting a small number of objects . . . . . . . . . . . . . . . . 12

2.1 Product of two polynomials . . . . . . . . . . . . . . . . . . . 39


2.2 Toeplitz matrices . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.3 Maximum sum . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4 Boolean matrices: The Four-Russians algorithm . . . . . . . . 41
2.5 Matrix multiplication and inversion . . . . . . . . . . . . . . . 42

3.1 Interval cover . . . . . . . . . . . . . . . . . . . . . . . . . . . 64


3.2 Memory usage . . . . . . . . . . . . . . . . . . . . . . . . . . 64
3.3 Scheduling dependent tasks on several machines . . . . . . . . 65
3.4 Scheduling independent tasks with priorities . . . . . . . . . . 66
3.5 Scheduling independent tasks with deadlines . . . . . . . . . . 66
3.6 Edge matroids . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.7 Huffman code . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

4.1 Matrix chains . . . . . . . . . . . . . . . . . . . . . . . . . . . 87


4.2 The library . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.3 Polygon triangulation . . . . . . . . . . . . . . . . . . . . . . 88
4.4 Square of ones . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.5 The wind band . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.6 Ski rental . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.7 Building set . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

5.1 Binary counter . . . . . . . . . . . . . . . . . . . . . . . . . . 108


5.2 Inserting and deleting . . . . . . . . . . . . . . . . . . . . . . 108
5.3 Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.4 Deleting half the elements . . . . . . . . . . . . . . . . . . . . 109
5.5 Searching and inserting . . . . . . . . . . . . . . . . . . . . . 109

xiii

© 2014 by Taylor & Francis Group, LLC


xiv

5.6 Splay trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110


5.7 Half perimeter of a polygon . . . . . . . . . . . . . . . . . . . 112

7.1 Wheel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149


7.2 Knights of the round table . . . . . . . . . . . . . . . . . . . . 149
7.3 Variants of CLIQUE . . . . . . . . . . . . . . . . . . . . . . . 149
7.4 Path with vertex pairs . . . . . . . . . . . . . . . . . . . . . . 150
7.5 VERTEX-COVER with even degrees . . . . . . . . . . . . . . 150
7.6 Around 2-PARTITION . . . . . . . . . . . . . . . . . . . . . . 150
7.7 COLOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.8 3-COLOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.9 3-COLOR-PLAN . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.10 Scheduling independent tasks with p processors . . . . . . . . 152
7.11 Scheduling with two processors . . . . . . . . . . . . . . . . . 152
7.12 Transitive subchain . . . . . . . . . . . . . . . . . . . . . . . . 153
7.13 INDEPENDENT SET . . . . . . . . . . . . . . . . . . . . . . 153
7.14 DOMINATING SET . . . . . . . . . . . . . . . . . . . . . . . 153
7.15 Carpenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.16 k-center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.17 Variants of 3-SAT . . . . . . . . . . . . . . . . . . . . . . . . 154
7.18 Variants of SAT . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.19 SUBSET-SUM . . . . . . . . . . . . . . . . . . . . . . . . . . 155
7.20 NP-completeness of 2-PARTITION . . . . . . . . . . . . . . . 155

9.1 Single machine scheduling . . . . . . . . . . . . . . . . . . . . 211


9.2 SUBSET-SUM . . . . . . . . . . . . . . . . . . . . . . . . . . 212
9.3 SET-COVER . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
9.4 VERTEX-COVER . . . . . . . . . . . . . . . . . . . . . . . . 213
9.5 Scheduling independent tasks in parallel . . . . . . . . . . . . 215
9.6 Point clustering . . . . . . . . . . . . . . . . . . . . . . . . . . 215
9.7 k-center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
9.8 Knapsack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
9.9 Mixed integer linear program for replica placement . . . . . . 218
9.10 A randomized algorithm for independent set . . . . . . . . . . 218
9.11 Branch-and-bound applied to MAX-SAT . . . . . . . . . . . . 219

© 2014 by Taylor & Francis Group, LLC


Preface

Objective
YABA? Yet Another Book on Algorithms?
No thanks. There are so many good books on the design of algorithms that
it is hard to choose and pick one. If asked to name our two favorite refer-
ences, we would recommend Introduction to Algorithms by Cormen, Leiserson,
Rivest, and Stein [27] and Algorithms by Dasgupta, Papadimitriou, and Vazi-
rani [30]. For sure, this book does not intend to compete with such established
monuments.
Instead, this book proposes a complementary perspective. It aims at guid-
ing students and researchers who need to solve problems, either by finding
optimal algorithms or by assessing new complexity results. In a nutshell, the
main objective of this book is to outline the roadmap to follow, and to prac-
tice all the corresponding steps, in order to determine the complexity of a
problem.

Intended audience and use


The target audience for this book is graduate students and postgraduate re-
searchers in computer science and related fields.
This book does have prerequisites: We expect the reader to have some
experience with the design of algorithms, maybe through following an under-
graduate course in the field, or through reading a few chapters of the reference
books quoted above. In particular, we assume that the reader is familiar with
classic algorithms, such as comparison-based sorting (e.g., quick sort or merge
sort), and has a good knowledge of elementary graph theory, including:
• traversals (depth-first, breadth-first, connected components);
• shortest paths (one-source, such as Dijkstra, all-pairs, such as Floyd–
Warshall);
• maximum matchings in bipartite graphs.
In fact, one needs to know only that efficient algorithms exist to solve these
graph theory problems, but, of course, it is better to understand how they
work. Because excellent external sources already cover these topics, we refer
to them.
Also, we assume that readers have already been exposed, at least up to
some extent, to the basic paradigms of algorithm design: divide-and-conquer,
greedy algorithms, dynamic programming, and amortized analysis. But here,
rather than (or in addition to) referring to external sources, this book provides

xv

© 2014 by Taylor & Francis Group, LLC


xvi

extensive material so that the readers can assess their skills by solving the
many exercises in Part I.
Part II of this book can be used to teach an undergraduate or graduate class
on NP-completeness, with a focus on polynomial reductions, and a survey of
approaches that go beyond NP-completeness.
Part III of this book can be used to teach a graduate class on advanced
algorithms, either in the form of a series of classes presenting the case studies,
or in the form of projects assigned to students.

Book content and organization


The book is composed of three main parts:
• Part I: Polynomial-time algorithms: Exercises
• Part II: NP-completeness and beyond
• Part III: Reasoning on problem complexity

Part I aims at training the reader to design efficient algorithms. To do


so, we provide a comprehensive set of problems to investigate. Problems are
organized along the main design principles, which we each revisit through a
brief introduction and a series of related exercises. This leads to five chapters:
1. Introduction to complexity
2. Divide-and-conquer
3. Greedy algorithms
4. Dynamic programming
5. Amortized analysis
All solutions to exercises are provided.

Part II deals with NP-completeness and beyond. Our coverage of NP-


completeness focuses on polynomial reductions. We deliberately ignore Tur-
ing machines and the theoretic arsenal. The (small) price to pay is to admit
Cook’s theorem, the existence of the canonical NP-complete problem, for-
mula satisfiability, a.k.a. SAT. In Part II, we also cover approaches that go
beyond NP-completeness: identifying polynomial instances, approximation
algorithms, linear programming, randomized algorithms, branch-and-bound,
and backtracking. Part II consists of four chapters:
1. NP-completeness
2. Exercises on NP-completeness
3. Beyond NP-completeness
4. Exercises going beyond NP-completeness
All solutions to exercises are provided.

Part III constitutes the main originality of the book. It is devoted to case
studies whose goal is to provide the reader with tools and techniques to assess
problem complexity: which instances are polynomial, and which are NP-hard,
and what do to for the latter. Part III consists of an introduction summarizing

© 2014 by Taylor & Francis Group, LLC


xvii

how to assess the complexity of a new problem, and it is illustrated with five
case studies:
1. Chains-on-chains partitioning
2. Replica placement in tree networks
3. Packet routing
4. Matrix product, or tiling the unit square
5. Online scheduling

Thanks
The content of this book, or at least preliminary versions of it, has been
used to teach courses at École Normale Supérieure de Lyon. We are grate-
ful to the students for their feedback and suggestions. We also thank all
our colleagues who helped gather the problems of Part I. The teaching assis-
tants when Yves Robert was teaching the Algorithms course were (ordering by
year) Odile Millet-Botta, Tanguy Risset, Alain Darte, Bruno Durand, Frédéric
Vivien, Jean-Christophe Dubacq, Olivier Bodini, Daniel Hirschkoff, Matthieu
Exbrayat, Natacha Portier, Emmanuel Hyon, Eric Thierry, Michel Morvan,
and Yves Caniou. The teaching assistants when Anne Benoit took over were
(ordering by year) Victor Poupet, Damien Regnault, Benjamin Depardon,
Jean-François Pineau, Clément Rezvoy, Christophe Mouilleron, Fanny Du-
fossé, and Anne-Cécile Orgerie.
We also wish to thank the following people who have contributed to some
of the content by their insightful suggestions, their own previously published
work, or their help reviewing draft chapters: Guillaume Aupy, Marin Bougeret,
Jean-Yves l’Excellent, Arnaud Legrand, Loris Marchal, Paul Renaud-Goud,
Veronika Sonigo, and Bora Uçar.
Finally, a word of caution on bibliographical notes: Some exercises have ap-
peared in many sources, and the references that we give may well not be the
original ones. Also, the absence of any reference is not a claim for originality!
However, all solutions are ours, and they have been tested and verified by the
students at ENS Lyon, the teaching assistants, and ourselves (but we keep the
sole responsibility for errors). We welcome comments and suggestions to our
e-mail addresses.

Anne Benoit, [email protected]


Yves Robert, [email protected]
Frédéric Vivien, [email protected]

© 2014 by Taylor & Francis Group, LLC


© 2014 by Taylor & Francis Group, LLC
Part I

Polynomial-time
algorithms: Exercises

© 2014 by Taylor & Francis Group, LLC


© 2014 by Taylor & Francis Group, LLC
Discovering Diverse Content Through
Random Scribd Documents
CHAPTER VI
WHO? AND WHY?

Half an hour later Johnny and Drew were back at the


shack. The squad car with its load of burly policemen
was gone.

For a long time nothing was said. Johnny’s head hurt. It


also ached in a most extraordinary manner. He felt sick
at the stomach. Life for him had gone suddenly very
strange.

“Drew,” he said at last, “that man, whoever he was,


didn’t give me a chance, not a single fighting chance.”

“Of course not. They never do, those gangsters.”

“Drew,” said Johnny, “I was hunting in the Arctic once,


stalking a polar bear all alone; following his track. He
turned the tables and started stalking me. But, Drew,
before he struck at me with that great paw of his, he
hissed like a goose.”

“Gave you a warning,” Drew said quietly. “Rattlesnake’d [66]


do that, too; but not a gangster.
“Johnny,” he said, suddenly wheeling about, “you’ve
been believing in that old saw, ‘honor among thieves.’
Forget it. There isn’t any. Not a bit.

“I’ve known them to run over a little family car, smash it


in bits with a powerful truck they were using to carry
illicit goods. Did they stop? Not much. Fired shots in the
air, and left little children to perish in the wreckage.
Honor! Not a bit. I tell you it’s war! Pitiless war waged
by monsters. And this land will not be free until they are
all safely lodged in jail.”

Again for a time there was silence.

“Drew,” Johnny spoke again, “I used to say that if a


man picked my pockets or held me up and got my
money, I’d say, ‘You are a smart guy,’ and let it go at
that, but that if he hit me on the head I’d spend the rest
of my life hunting him. And when I found him I’d kill
him. That man hit me, Drew, hit almost hard enough to
kill, and without warning!”

“He did,” said Drew, “and we are going to get him, you [67]
and I. But after we get him, I guess we’d better let the
courts deal with him. Justice, Johnny, is an arrow, a
keen pointed arrow that goes straight and fair.
Sometimes I think it is an arrow of fire that burns as it
strikes.”

Johnny thought that a strange expression. He was to


learn more of it as the days passed.

“First thing we’ve got to do to-morrow,” said Drew, “is


to work out the probabilities?”

“The probabilities?”
“Sure. You’ve read detective stories?”

“Sometimes.”

“Know how most of ’em go? A murder. One of six men


may have done the killing. This one might have, or that
one. This one probably did. And this one, well, you
hardly consider him at all. But in the end, it’s always the
one you did not suspect. It’s the bunk. Real life is not
like that at all. You have to figure out what is probably
true, and try to prove that it is true. It usually is.

“Take this case of yours. You are to be a kingpin witness [68]


in my case against two pickpockets. Your testimony will
convict them. No doubt about it. Do they belong to a
well organized gang? Did a member of the gang try to
do away with you so you could not testify? It’s been
done many times.

“Another possibility. You were about to put through a


squad call. What was that call? Was it important? Was a
big burglary in progress? Was this man sent up to
silence the radio and prevent the squad call? If that was
the angle, was more than one major crime committed in
that half hour? If so, which one was connected with the
attack upon you?

“Once again; many a gang’s activities have been


interrupted, their purpose thwarted, by radio squad
calls. The leader of one of these gangs may have
decided to take revenge; hence the raid to-night.

“So you see,” he said, rising, “there are several [69]


possibilities to work out. The probability must be
reached. Herman McCarthey will have all the dope in
the morning. He will help us work it out. He is a
seasoned trooper and has a wise old head on his
shoulders. Meantime, you must try to recall every
incident connected with the affair.”

“I remember one thing,” said Johnny. “It came to me at


this very instant. I didn’t see the man’s face, but I saw
his hand, a large dark hand, and it was deeply scarred.
It had a hole in the middle of the palm.”

“Good!” exclaimed Drew. “Couldn’t be better. Take us a


long way, that will.

“And now we must catch three winks. To-morrow is a


big day. To-morrow you are to be our star witness.”

[70]
CHAPTER VII
IN COURT

Johnny and Drew were up at eight o’clock next morning.


At 8:30 the black-haired, dark-eyed girl with smiling lips
and dimpled cheeks brought in steaming coffee and
some unusual but delicious pastry.

Drew called her Rosy, and patted her on the arm. Rosy’s
dimples deepened.

Who was Rosy? Why did she live in that other shack
among the walls of brick and mortar? Why did Drew
room in this odd place? Johnny wanted to ask all these
questions. Realizing that their answers did not greatly
concern him, he asked none of them.

At ten o’clock he and Drew were seated on the front


bench of the “Local 46,” the particular court room in
which their pickpocket case was to be tried.

The whole scene was packed with interest for Johnny. [71]
The judge in his box-like coop, the young prosecutor
and the deputies standing below, the motley throng that
filled the seats at his back, each waiting his turn to
appear as complainant, defendant or witness, made a
picture he would not soon forget.

The judge was a dark-skinned man of foreign


appearance. His hair was long. His eyes were large, and
at times piercing. He sat slumped down in his chair.
When sudden problems arose, he had a trick of bracing
his hands on the arms of his chair and peering at a
prisoner as a hawk might peer at a squirrel or a mouse.

“He’s Italian,” said Drew. “Smart man. Knows his


business. Square, too. A good judge. Lots of fun, too, if
he wants to be.”

At this moment two names were called. Two large men,


respectably dressed, walked up the aisle to take their
places at the high, narrow table just before the judge’s
stand. Two officers stepped up beside them.

“Confidence men,” whispered Drew. “We all know them. [72]


Haven’t got a thing on them, though, I’ll bet. Just
picked them up on suspicion. They get thousands every
year from people who are looking for a chance to make
easy money. They—

“See! I told you. The judge is letting them go. It’s not
what you know that counts in court. It’s what you can
prove.”

Once more the stage was set. An attractive young


woman, carefully and tastefully dressed, a young man
at her side, a middle-aged man of stocky build carrying
a package, a young lady of the shop-girl type at his
side; these four stood before the judge.

“Young lady,” said the judge, leaning forward and


adjusting his glasses as he spoke to the well dressed
one, “you are charged with the theft of one dress, taken
from the store of Dobbs, Hobson & Dobbs; value
$14.00. Guilty, or not guilty?”

“Guilty,” the girl murmured with downcast eyes.

“It is my duty,” the judge leaned forward in his chair, “to [73]
warn you that if you plead guilty I may fine you from
one dollar to one hundred dollars, or send you to jail for
from one day to one year. Knowing this, do you still
wish to plead guilty?” His tone was impressive.

The girl hesitated. A short, gray-haired man stepped up


and whispered in her ear.

“Her lawyer,” explained Drew.

“Guilty.” The girl nodded her head.

The evidence was presented. Then the husband of the


young lady spoke: “If your Honor please. This is the first
time this sort of thing has happened. I will give my
pledge that it will not happen again.”

The judge raised himself on his elbows, stared through


his glasses and exclaimed: “I’ll see that it doesn’t
happen again for sixty days. The idea! A woman of your
intelligence going into a store and carrying off a dress
that doesn’t belong to you and you don’t need! Why did
you do it?”

“I—I don’t know, Judge. I—I just saw it there. I—I liked
it. So, the first thing I knew I was taking it away.”

“Exactly. Sixty days! Sit over there.”

[74]
The judge pointed to a row of chairs at the right of his
box; the defendant burst into tears, dabbled her eyes
with an embroidered handkerchief; her young husband
led her to a seat and, for the time, the affair was ended.

“The judge will allow her to weep for a couple of hours,”


Drew explained in a whisper. “Meantime, his secretary in
the back room will get some people on the wire and
look up her record. If her record is good, he’ll set his
sentence aside, put her on a year’s probation. Probably
never hear from her again. She’s had about enough.

“But why do they do it?” he exclaimed in a whisper. “If


you were a young woman would you go through all this
and carry the memory of the humiliation and disgrace
through a long life for a fourteen dollar dress? You
would not; nor for forty dresses!

“But they do it, over and over and over. Hats, belts,
coats, dresses, artificial flowers. What don’t they steal?
And they come to court, sometimes three or four a day,
to stand before the judge and weep. You’d think they’d
learn, that everyone in the world would learn after
awhile, everyone, except the professional shoplifter. But
they don’t.”

And now a score of young black men stood before the [75]
bench. They were accused of gambling with dice. The
dice, a hook for raking them in, and a few coins were
offered in evidence.

“Who was running this game?” the judge thundered at


them. Nobody knew; not even the arresting officer.

“Well,” said the judge, “you all working?”

“Ya-as, sir.”
“Got good jobs?”

“Ya-as, sir.”

“Louder.” The judge cupped a hand to his ear. “You all


got real good jobs?”

“Ya-as, SIR!”

“All right, you can go, but we have a police benefit fund
here. If you’ve all got real good jobs you might
contribute a dollar each to that fund.”

The black men went into a huddle. They produced the


required sum and marched out.

“One of the judge’s little jokes,” Drew smiled. “I don’t [76]


see how he could live through all this low down squalor
day after day if it wasn’t for his jokes.”

“I want to tell you, Johnny, I wish I could tell every boy


in the land a thousand times, crime is not attractive! It
is mean and low down, sordid and dirty. That’s the best
you can make out of it.”

“One more case,” he whispered as he rose, “then comes


ours. You wait here. I’ll go get the men.”

[77]
CHAPTER VIII
PRISONERS AT THE BAR

Johnny will never know what that next brief trial was
about. It had struck him all of a sudden that he was to
play a part in the trial that was to follow. This thought
set his blood racing. He was glad not to be the
defendant. But as a witness his responsibility was great.
For the first time in his life he was to utter words that
would without doubt send a fellow human being to jail.
The thought was not pleasing.

“And yet it’s my plain duty,” he told himself. He found


much consolation in that.

A fresh turn of his mind for the moment crowded out all [78]
other thought. Who had beaten him up the night
before? Was it some pal of these pickpockets? Would he
be able to tell from the expressions on their faces when
they saw him? His head was heavily bandaged. “They
could not help but notice that. Perhaps they believe that
their confederate made a thorough job of it,” he told
himself. “They may not expect to see me here at all.”

“Ah! Now’s the time!” he whispered to himself. His name


was being called. So, too, were the names of the two
pickpockets and Drew Lane.

“Here they come.” He caught his breath and half rose


from his chair. As he did so, one of the two prisoners
coming down the aisle caught sight of him. It was the
larger of the pickpockets. For ten seconds he stood
there motionless, one foot poised in midair. Then his
face spread in a broad grin, and he marched on up to
the bar.

That grin puzzled the boy. “Wouldn’t grin if he hadn’t


expected to see me,” he reasoned. “But why the grin at
all?”

There was no further time for such thoughts. He was at [79]


the bar, between a police officer and a pickpocket. His
right hand was in the air. He was being sworn to “tell
the truth, the whole truth, and nothing but the truth, so
help me, God.”

It struck him all of a sudden that some witnesses these


days truly needed Divine help if they told the whole
truth. He felt his bandaged head, and resolved to honor
his oath, come what might; not only now, but always.

The judge went through with the usual formalities. The


prisoners were charged with the theft of a purse. Guilty,
or not guilty? A hook-nosed lawyer had advised a plea
of guilty.

“And do you wish to be tried by this court?”

“Yes, your Honor.”

The prisoners were warned of the possible outcome. Did


they still wish to plead guilty? They did.
The trial began. Johnny was asked to tell his story. This
he did in a straightforward manner, in spite of numerous
interruptions from the lawyer for the defence. He
neglected no detail of the little drama that was played
by Drew and Howe, two pickpockets and himself on that
fateful June day.

“Is that true?” The judge leaned forward to glower at [80]


the older of the two prisoners.

“Yes, your Honor. But, your Honor, it’s the police. They
—”

“Just a moment,” the judge cut him short. “I asked you


a question. You say this young man has told the truth?
Very well.

“Now you tell us what you know.” He nodded to Drew


Lane.

Drew said that he and his fellow detective, Howe, had


been riding that car line for three days, because there
had been several losses by surface line riders along that
line.

“When we saw these two birds,” he went on, “we knew


we had our men. We—”

“You knew them?” the judge interrupted.

“It’s our business to know them. We know more than


three hundred pickpockets by sight.”

“You’re too darn smart!” snarled the slighter of the two


prisoners.

The bailiff rapped for order.


“Have these men a record?” the judge asked.

Drew Lane passed up two sheets of paper. [81]

The judge studied these with a gathering scowl. Then


his face lighted as he looked at Drew Lane.

“Bad ones. That right?”

Drew nodded.

“Go on. Tell us what happened.”

“We saw them take this boy’s pocketbook. They saw us


and made a break for it. We nabbed them. That’s all.
What this boy told you is true, as far as we saw it.”

“It must be,” agreed the judge. “They don’t even deny
it.

“What have you got to say?” He turned a poker face


toward the prisoners.

The larger one answered, “It’s the police, Judge, and


the detectives. I was goin’ to tell you, Judge. They
won’t leave us alone. We been out of the jug six
months. Been goin’ straight.”

“Call picking pockets going straight?” the judge flashed.

“We wouldn’t have done it, Judge, only them college


boy detectives made us.”

He glared at Drew Lane. [82]

“Your Honor,” a flicker of a smile hovered about Drew


Lane’s mouth, “I object to being called a college kid.
I’ve been out of college four years, and been in the
service all that time.”

“I wouldn’t,” the judge leaned forward and pretended to


whisper, “I wouldn’t object at all if I were you. It’s your
greatest asset. They don’t know you’re a detective,
these fellows, and when they do they don’t take you
seriously. That right?” He winked at the older
pickpocket.

“That was it, Judge. You see, Judge,” the man went on,
encouraged by the judge’s disarming smile, “I knew this
boy was a detective. I—I’d see him before, and I says to
Jimmy, me pal here, I says, just whispers, y’
understand, ‘Jimmy,’ I says, ‘it would be great sport to
grab that country boy’s wad right before this college boy
detective’s eyes.’ We done it for sport, Judge, honest we
did.” The prisoner essayed a laugh, which turned out
number one common, and scarcely that.

“I see,” said the judge, leaning back in his chair and [83]
appearing to think deeply. “You stole a hundred dollars
from an innocent boy as a joke on a boy detective? You
were getting off the car, weren’t you?”

“Yes, your Honor.”

“And the boy was getting off to go another way. How


did you expect to get his money back to him? How did
you mean to explain his loss to him?”

“Your Honor, we—”

“Ah no! You didn’t do it as a joke!” The judge leaned far


forward. There was a glint of fire in his eye. The smile
had faded from his face as a field of sunshine is blotted
out by dark October clouds. “You meant to steal that
boy’s pocketbook. These records show that.

“It didn’t matter to you that this boy might be left


penniless in a strange city. If it had been a poor shop-
girl with two weeks’ pay in her purse, the price of a well
earned week’s vacation, you’d have done it too. It
wouldn’t have meant anything to you if it had been a
scrub-woman. If the money had been earned by eight
hours of scrubbing six days a week, you’d have taken it
just the same.

“You don’t want to go straight. You want to be [84]


pickpockets. That’s the only occupation you have. It’s
the only one you’ll ever have, except when you’re in jail.
And that’s where you’ll be for some time.

“Six months. Take them away.”

The deputies led the prisoners down the aisle. Johnny


followed Drew out into the bright sunshine of a beautiful
June morning.

“So that’s the way they do it?” Johnny said breathlessly.

“It’s the way they do it sometimes,” replied Drew.

“You see,” he went on to explain, “you are a transient


witness. You are here now. But if we needed you to
appear before a jury as a witness in this case four
months from now, would you be in Chicago?”

“Four months is a long time.”

“Sure it is. Ordinarily those fellows would have gone [85]


before a grand jury and been held over to the higher
courts. They’d been tried by a jury and got three or four
years; that is, if you were present. But the judge,
knowing you were likely to leave the city, made the best
of things and tried them for larceny. He gave them all
he could, under the circumstances. They are out of the
way for a while at least.

“Well, that’s that!” Drew said a moment later. “Thanks a


heap. You made our case for us. You helped us; now it’s
up to us to help you find the fellow who battered up
your head. Herman McCarthey is in the station now.
Let’s go back and see what he’s uncovered.”

Retracing their steps, they walked once more into the


lobby of the police station and waited for an up-bound
elevator.

[86]
CHAPTER IX
CLUES

“It’s queer the way the thing works out.” Sergeant


McCarthey looked the two boys squarely in the eyes
when Drew Lane asked him how he had progressed
with the radio station case.

Meanwhile Johnny was sizing up the sergeant. Nothing


very wonderful to look at, this Sergeant McCarthey.
Average size he was, with a face like a hawk. His nose
was too long. It was curved like a beak. Shining out
from behind it were two small black eyes. His head was,
for the most part, bald, and he was but forty-five.

“Reminds me of a bald eagle,” Johnny told himself.

To complete the picture Johnny discovered an ugly scar [87]


running down the sergeant’s jaw and around his neck.
The sergeant had got that scar during his first year of
service. A holdup man, caught in the act, had pretended
to surrender. He had given up his gun, but seeing an
opening, had stabbed McCarthey, half behind his back.
From that time on McCarthey began earning the name
of the hardest man on the force. Certainly he made
them “stick ’em up, and keep ’em up.” For all that, there
were those who knew that the sergeant had a very
human side.

“What do you think, Drew?” he shot at the young


detective. “Do you think those pickpockets had their
gang walk in on this boy and beat him up?” He was
speaking of Johnny.

“Tell the truth, I don’t,” said Drew Lane. “First place


they laughed when they saw him. If—”

“Can’t tell as much about a crook’s laugh as you can a


bullfrog’s croak,” McCarthey broke in. “Not as much.
When a frog croaks he’s saying he’s happy. A crook’s
liable to laugh when he gets ten years.”

“It’s not just that,” said Drew. “You know yourself that [88]
pickpockets are sneaks; coyotes, not wolves. They may
be well organized in some cities. They’re not in this
one.”

“You’re right,” said McCarthey, shuffling a sheaf of


papers on the desk. “That possibility is about all there is
to that clue. But we’ll keep the sheets; you never can
tell.

“I work it out this way.” He spread five sheets of paper


on the desk. “See! This one is for your pickpocket
friends who are naturally afraid of Johnny as a star
witness against them. We’ll put it over here.” He laid it
aside.

“But what about the squad call that was going through
when the raid on the radio station was made?” Drew
broke in.
“I’m coming to that. That’s the queer part,” the sergeant
went on. “You see I have four sheets left. That means
four possibilities.

“Since you insist, we’ll take the call that was going
through when the station was raided. You’ll be
surprised. That squad call was a notice that someone
was breaking in over on Lake Shore Drive. Swell
apartment. People all gone. When the radio failed to
give the alarm, a squad was sent out from the local
police station, and the burglars were caught.”

“Oh!” Johnny leaned forward expectantly. [89]

“That’s what I thought,” grumbled the sergeant. “But


they turned out to be two kids, one about twenty, the
other younger. Dressed like college kids, they were, in
yellow slickers decorated with hearts and kewpies; you
know the sort.

“But let me tell you one thing. You may lay a bet those
boys never saw the inside of any college. I’ve been
watching. We don’t get many real college boys. When
they’re smart enough and good enough workers to get
up to college, they’re too smart to think they can beat
the game by turning crooks.”

“But where did the boys come from?” Johnny asked.

“That’s what they didn’t tell,” said McCarthey. “If we


knew, it might throw some light on the subject. But you
can see how likely it is that a bunch of kids are going to
figure out that they’ll get caught burglarizing an empty
flat unless they send someone to beat up a radio
announcer or two. And besides, if they did, who would
they get to go for ’em? Too dangerous. Lot worse than
burglarizing.
“So that,” he threw the second sheet aside, “looks like a [90]
doubtful chance. But we’ll keep ’em all.

“Another queer thing.” He turned to the third sheet.


“Not many cases go out over the air. We can handle ’em
other ways. Three an hour is a good many. But in that
fifteen minutes when the radio station was dead,
smashed to bits, there were three squad calls that did
not go out, and two were mighty important.

“You know that long row of warehouses just back of


your shack, Drew?” He turned to Drew Lane.

“Sure.”

“Some cracksmen burst the safe in the third one from


the water, ten minutes after the radio station was
smashed.”

“That looks like a hot scent,” said Drew, starting forward


to bend over McCarthey’s sheet.

“Rather blind one, at that,” said the sergeant. “No one [91]
saw them. A straggler heard the blast and turned in the
alarm. Squad came. Safe was looted. Birds flown. Might
have gone a dozen ways, rowboat, on foot, in a car.
Gone, that’s all. Got something over a thousand dollars.
Left nothing, not even a fingerprint.”

“It’s too bad,” sighed Drew. “I’d say that was the likely
case. Going to blow up a safe. Mighty few cases these
days. Since the radio gave us a lift, electric drills are
cheap. Radio’s too quick for them. Whang! goes the
blast; r-ring-ring! the telephone; gong-gong! the radio;
and the police squad is on the way; all too soon for the
safe-cracker.
“Easy enough to see why they’d send an accomplice
over to break up the radio!”

“Ah, well!” McCarthey’s narrow eyes contracted. “Give


us time. Not so many of ’em escape us.

“The other case that came off in that fateful quarter of [92]
an hour was a theatre holdup on State Street, just over
the river; one of those quiet little affairs. Two men say,
‘Stick ’em up! Give us the swag. Don’t yell! Don’t move
for a full minute, or you’ll be dead!’ A car. Quick
getaway. And there you are!

“No clue. Nothing to go by. One of those things that are


mighty hard to trace.”

“And you don’t think they could have had a friend—”


began Johnny.

“Who made you a call? Not likely,” McCarthey laughed.


“Little those birds fear the radio. They’re too quick. No
radio will ever stop ’em. They’re like the army transports
during the war that were too fast for the submarines.

“This last sheet,” he added, “I have saved for gentlemen


who, on other occasions, have had their gentle business
of robbing, burglarizing, bombing, safe-blowing and the
like interfered with. From time to time I will enter the
names here of those who show undue resentment to
the radio activities of the police.

“And that, boys,” he concluded, once more shuffling his


sheaf of papers, “appears to bring the case to date.
These are the facts. Draw your own conclusions.”

“Conclusions!” Johnny said as he left the office. “I only [93]


conclude that I was slugged; that my telephone was
smashed; and that my head still is very sore.”

“Give him time,” said Drew. “He seldom fails. In the


meantime, we must do our bit.”

[94]
CHAPTER X
A ROYAL FEAST

That evening at nine o’clock Johnny was given a


delightful surprise. At the same time some of the
questions that had been revolving about in his mind like
six squirrels in one cage were solved.

He had returned to the shack at six. Weary from his


exciting day, he had stretched himself out on his cot and
had at once fallen asleep.

Awakened by someone entering the room, and startled


by the darkness that had settled upon the place since
he fell asleep, he was about to cry out in alarm when
the place was flooded with light and he found Drew
Lane smiling down upon him.

“Have a good rest?” he asked.

“Fine. And you? What luck this afternoon?”

“No luck at all. But that’s what one must expect. You [95]
can’t get ’em every day. If you did you’d soon be out of
a job. All the crooks would be behind the bars.
“Not that I’d care,” he hastened to add. “There are a lot
of occupations more congenial. If I didn’t have a
conscience that keeps me hunting men, I’d take up
commercial aviation. There’s a job for you! I can fly.
Have a hundred and ten hours to my credit, and never a
crack-up.”

“Think they’ll ever use airplanes in hunting criminals?”


asked Johnny, sitting up.

“Might. Couldn’t do much right in the city. But if a gang


was supposed to be leaving town; if the car they used
was well marked, you could do a lot with a plane; soar
about, watching a hundred roads at once.”

“Had anything to eat?” Drew asked, as Johnny rose and


busied himself with his toilet.

“Not since noon.”

“My treat to-night. And you’ll like it. Mrs. Ramacciotti


has some ravioli a la Tuscany on the stove.”

“What’s all that?” [96]

“You’ll see. Just get on your collar and tie. We’ll want
plenty of time for a feast before you go back there to
get beaten up again. Or are you going?”

“Think I’d stay away?” Johnny gave him a look.

“No, I didn’t. But if I were you I’d sit with my back to


the wall.”

“Do more than that. Take ‘Silent Murder,’ as you call


him, along.” He nodded toward the bow that stood in
the corner.
“Too slow. Better get a gun.”

“Slow! Sometime I’ll show you. That studio is all of


twenty-five feet long. Door’s at one end. My cubby-
hole’s at the other. Let anyone try getting to me after
this!” He picked up an arrow and felt its razor-like point.
“Silent murder,” he mused. “About right, I guess.”

To Johnny’s surprise he found that the feast Drew had [97]


alluded to was just ten steps from their own door. Down
one low flight of stairs, up another, and there they were
in the shack that stood before their own and fronted the
street.

A large, dark-skinned woman of middle age greeted


them with a smile that was genuine, and a handshake
that was “all there.”

“This is Mrs. Ramacciotti,” said Drew. “Without her and


Rosy this city would be a dreary place.”

Rosy stood by the table dimpling and smiling her


thanks.

Johnny had seen Rosy before. Now, however, she was


dressed for the occasion, and one good look at her
made him think of cool meadows, shady orchards,
blushing russet apples, and all the rest.

“I don’t blame Drew,” he told himself.

They were invited to take seats before a small square


table covered with a cloth of snowy linen. At once a
steaming platter was set before them.

“But what’s on the platter?” Johnny asked himself.


“Dumplings in meat gravy?”
It was far more than that. The finest of chicken meat, [98]
run through a grinder, some fine chopped veal; carrots
cut fine, and who knows what else of viands and
seasoning had been mixed together and used as the
filling for small, turnover pies. These had been boiled
for half an hour in salt water. After that they were
smothered in rich gravy. A layer of meat pies, then one
of gravy, then pies again until they stood a foot high on
the platter.

But then, who can describe ravioli a la Tuscany? It is the


proudest dish of Italians, and they are an exceedingly
proud people.

For a full half hour the time was spent between small
talk, and much eating.

As Johnny pushed back his chair with a sigh of regret,


Mrs. Ramacciotti put her hand to her hair, and said in a
sympathetic tone:

“Your head. What could have happened to it?”

“Haven’t you heard?” exclaimed Drew. “Some gangster


beat him up last night.”

“Oh, the miserable ones!” Madame spread her hands in


horror. “But why? He is only a boy.”

“I’ll tell you,” said Drew. He proceeded to tell of [99]


Johnny’s unusual adventures.

“And the only thing we know,” supplemented Johnny at


the end, “is that the man has a hole in his hand. I saw
that. I—”
But what was this? Rosy had uttered a low scream, then
had dropped into a chair. Her face had gone white.

“Now! Now!” her mother said, placing a protecting hand


across her shoulder.

“You see,” the Italian mother’s face took on added


character as she spoke in a low, clear, steady tone, “her
papa was shot by a man. He wanted papa’s money. He
would give. But he not always understand. He move his
hand to pocket. Always he did so when he was nervous.
This man shoot him—dead! Rosy, she see this man. See
hole in the hand. Same man? What you think? Mebby
so.”

Johnny and Drew stared at one another.

Johnny was thinking, “So the man who beat me up was


a murderer!”

“You never told me this before,” said Drew, speaking to


Mrs. Ramacciotti.

“No. I did not know you then. You did not work on the [100]
case. The man, he was never found.”

“Well,” said Drew as his lips drew together in a tight


line, “now we know, and we have a double reason for
getting the man with a hole in his hand. And we will get
him. Never fear.”

This unfortunate interruption of their party ended in a


prolonged silence. In the end the two boys expressed
sincere thanks for the splendid feast and begged to be
excused.
Rosy, with an effort, summoned one of her sweetest
smiles of farewell. As she stood there framed in the
door, a brave little orphan of gangland’s making, Johnny
could not help feeling that their common tragic interest
in finding the man with a hole in his hand was destined
to bring them very close together in the days that were
to come. Nor was he far wrong.

[101]
CHAPTER XI
SWORN TO STAND BY

Johnny’s return to the radio studio that night caused


quite a sensation. He arrived somewhat ahead of time.
The girl who presided over the switchboard, one floor
lower than the studio proper, was still at her post.

“Gee!” She stared at him, wide-eyed. “They nearly killed


you, didn’t they?”

“Tried it, I guess,” Johnny admitted.

“And still you came back?”

“Lightning never strikes twice in the same place,”


Johnny laughed.

“It does. I’ve seen it. Very same tree. Going to strike
twice here, too. Something tells me that. You’ll see.
They’ll bomb this place. When those Sicilians start a
thing they never quit ’til they get what they want. That’s
what my dad says. And he knows. I’m quitting; to-
morrow night’s my last. Dad says, ‘Let the police do
their own work.’ And that’s what I say, too.”
“If the officers of the law were not backed up by the [102]
honest people of a great city like this,” Johnny replied
thoughtfully, “nobody’s life would be safe for a moment.
In such times as these every man must do his duty.”

“Not for me, sonny, not for me! I know where there’s a
safe place to work, and me for it!”

Johnny climbed the stairs with heavy steps, only to


learn that his operator of the night before had also quit.

“Quit us cold,” was the way Bill Heyworth, the sturdy


night manager and chief announcer, put it. Bill was
thirty, or past. He was a broad shouldered Scotchman
with a stubborn jaw. “Said he didn’t want to be shot at.
Well,” he philosophized, “guess nobody does. But
somebody has to carry on here. This thing is not going
to stop because the gangs want it stopped. In time, of
course, the city will have a station of its own. That will
let us out. But until then the squad calls will go through
if we have to call upon the State Militia to protect us.
This city, officer and civilian, has set itself for a cleaning
up. And a cleaning it shall be!

“What’s that?” he asked, as Johnny drew forth his six [103]


foot yew bow.

“A plaything, you might say,” Johnny smiled. “Then


again you might say it has its practical side. I’ll
demonstrate.”

Picking up a bundle of magazines, he set them on end


atop a table against the wall. The outermost magazine
had an oval in the center of its cover-jacket the size of a
silver dollar.
Johnny drew back to the end of the room, then nocked
an arrow and drove it through the very center of that
spot.

Bill Heyworth whistled. He whistled again when Johnny


showed him that four of the thick magazines had been
pierced by the arrow’s steel point.

“Of course,” said Johnny, laughing low, “I don’t expect


ever to use it here. But I’ll feel safer if you allow me to
turn that chair about so I’ll be facing the entrance to
this studio and have this ‘Silent Murder,’ as Drew Lane
calls it, close at hand. Do I have your permission?”

“With all my heart, son. With all my heart. And you’ll [104]
stick?”

“Till they drag me out by the feet!”

“Two of us!” The Scotchman put out a hand. Johnny


gripped it tight, then went to his post.

* * * * * * * *

The days that followed were quiet ones for Johnny.


There needs must be many quiet days in every life.
These days, calm as a May morning, placid as a mill
pond, give us strength and fortitude for those stormy
periods that from time to time break upon us.

But these were not uninteresting days. Far from it.


Hours spent in a fresh environment, among new and
interesting people, are seldom dull.

There are few more interesting places than the studio of [105]
a great radio station. Besides the never ending stream
of famous ones, great authors, moving-picture actors,
statesmen, musicians of high rank, opera singers, and
many more, there are the regulars, those who come
night after night with their carefully prepared programs
planned to entertain and amuse a tired world.

That he might cultivate the society of those more


skilled, more famous than he, Johnny arrived night after
night an hour or two ahead of his schedule.

He came, in time, to think of himself as one of them.


And he gloried in this rich environment.

Bill Heyworth, the night manager, was himself worthy of


long study. A doughty Scotchman, sturdy as an oak,
dependable as an observatory clock, brave as any who
ever wore kilts, a three year veteran of the great World
War; yet withal, bubbling over with good humor, he was
a fit pattern for any boy.

Quite different, yet not less interesting, were the


comedy pair, one very slim, one stout, who came in
every evening at ten o’clock to put on the adventures of
a German street band.

Not all the skilled musicians were transients. The [106]


Anthony Trio, piano, violin and cello, might have graced
the program on many a notable occasion, yet here they
were, night after night, sending out over the ether their
skillful renditions of the best that other times have
produced in the realm of music.

Dorothy Anthony, the violinist, a short, vivacious girl


with a well rounded figure and dancing blue eyes,
seemed no older than Johnny himself. Many a talk, gay
and serious, they had, for Dorothy took her outdoor
adventures at second hand. She listened and exclaimed
over Johnny’s experiences in strange lands, and insisted
more than once upon his demonstrating his skill by
shooting at the magazines with his bow and arrow.

As for his bow, it stood so long in the corner that it


seemed certain that it would dry out and become too
brittle for real service in emergency.

Though Johnny enjoyed the company of the great and [107]


the near-great, he found most satisfaction in his
association with a certain humble individual who
occupied a small space before the switchboard at the
foot of the stairs. And that person was none other than
Rosy Ramacciotti. Since Johnny had been told that Rosy
was in need of work, he had hastened to secure this
position for her.

He had thought at first, because of her father’s most


unhappy death, she, too, might be afraid. When he
suggested this to her he was astonished by the
snapping of her black eyes as she exclaimed:

“Me afraid? No! I am Italian. Did you not know that? We


Italians, we are many things. Afraid? Never!”

So Rosy presided at the switchboard. Each night, during


the hour that preceded Rosy’s departure and Johnny’s
taking up of his duties, they enjoyed a chat about many,
many things.

Nor did Drew Lane object; for, as he one night explained


to Johnny, his relations with the Ramacciottis were
based on little more than a charitable desire to be of
service to someone.

“You have heard, I suppose,” he said to Johnny one [108]


evening, “that there is a society that looks after the
families of policemen who lose their lives in the service.
That is a splendid enterprise.

“There are also many societies in existence that take


care of the interests of criminals and their families. That
too, I suppose, is all right.

“But where is the society that cares for the women and
children made widows and orphans by the bullets of
gangsters, burglars, and robbers? Never heard of one,
did you?

“Well, some of us fellows of the Force decided to do


what we could for these.

“I learned of the Ramacciotti family. They had inherited


a small candy store and a large debt. They were paying
sixty dollars a month flat rent, and going bankrupt
rapidly.

“I helped them sell out the store. Then I found these


two shacks. Used to be fishing shacks, I suppose,
twenty-five years ago. Tried to find the owner. Couldn’t.
So we moved in anyway. I pay for my room and
morning coffee. The furniture is Mrs. Ramacciotti’s.

“I found her a small kitchen and dining room down [109]


street, where she serves rare Italian dishes, ravioli a la
Tuscany and the like. They are doing very well, and are
happy.

“Happy. That’s it,” he mused. “Everyone in the world has


a right to be happy. It’s our duty, yours and mine, to be
happy, and to do the best we can to help others to their
share of happiness.”
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookluna.com

You might also like