MAC addresses, 877
benefits, 945
description, 907
overview, 930
TOY machine, 914
Magnitude
Magritte, René, 363
multiple, 229
Majority function
sum-of-products circuits, 1027
truth tables for, 1025
Maps, Mercator projections, 48
Markov, Andrey, 176
Markov chains
impact, 184
overview, 176
Markov model paradigm, 460
Markovian queues, 597
Masking bitwise operations, 892–893
Matcher
class for REs, 763
Matching graphs, 713
Math
library, 192
accessing, 228
Mathematical analysis, 498–502
Mathematical functions, 202–204
Mathematical induction, 262, 266
Mathematical models, 716
Matiyasevich, Yuri, 816
Matlab language, 1094
Matrices
boolean, 302
Hadamard, 122
matrix multiplication, 109
sparse, 666
two-dimensional arrays, 106, 109–110
vector multiplication, 110, 180
Maximum values in arrays, 209
Maximum keys in BSTs, 651
Maxwell–Boltzmann distributions, 257
McCarthy’s 91 function, 298
Mechanical systems, graphs for, 673
Memoization, 284
Memory
available, 520
feedback loops as, 1048
interfaces, 1054
linked lists, 571
memory bits, 1056
recursion, 282
references, 367
safe pointers, 366
strings, 515
two-dimensional arrays, 107
Memory dumps, 909
Memory instructions
address instructions, 912
TOY machine, 913
Memory writes for CPU, 1079
Memoryless queues, 597
Mercator projections, 48
Mergesort
divide-and-conquer, 554
performance, 553
Method references, 470
Methods
abstract, 446
call chaining, 404
deprecated, 469
instance vs. static, 340
overriding, 452
static. See Functions; Static methods
stub, 303
MIDI Tuning Standard, 161
Midpoint displacement method, 278, 280
Milgram, Stanley, 670
Minimum keys in BSTs, 651
Minus signs (-
)
compound assignments, 60
integers, 22
lambda expressions, 450
MIX machine, 947
Mixing Markov chains, 176, 179–184
Models
circuit. See Circuit models
computational, 716
mathematical, 716
Modular programming, 191
debugging, 253
encapsulation, 432
machine language, 932
maintenance, 253
abstraction layers, 1037
as classes, 228
CPU, 1076
description, 1034
interactions, 319
overview, 191
program counters, 1073
size, 319
summary, 254
Monte Carlo simulation, 300, 307–308
Moore’s Law
coping with, 971
Move-to-front strategy, 620
Movie–performer graph, 680
Multidimensional arrays, 111
Multiple arguments, 197
Multiple inheritance, 470
Multiple main()
methods, 229
Multiple return
statements, 198
Multiple I/O streams, 143
Multiplexers
bus switching, 1035
description, 1023
Multiplication
P search problems, 839
polar representation, 433
Multiway gates, 1015–1017, 1023
file format, 483
summary, 488
Names
arrays, 91
objects, 362
variables, 16
vertices, 675
Nash, John, 840
Natural numbers, 875
Natural recursion, 262
Negation axiom, 990
Negative numbers
array indexes, 116
Neighbor vertices, 671
Nested classes
iterators, 574
Nesting conditionals and loops, 62–64
new
keyword
constructors, 385
Node
objects, 609
String
objects, 333
Newcomb, Simon, 224
Newline characters (\n
)
compiler considerations, 10
escape sequences, 19
Newton, Isaac
dice question, 88
square root method, 65
Newton’s law of gravitation, 481
Newton’s second law of motion, 480–481
NFAs. See Nondeterministic finite-state automata (NFAs)
Nodes
new
keyword, 609
Nondeterministic finite-state automata (NFAs)
Kleene’s theorem. See Kleene’s theorem
overview, 744
trace example, 747
Nondominant inner loops, 510
NOR gates
cross-coupled, 1050
description, 1014
Normal distribution functions
addressing problems, 852
boolean satisfiability, 853–856
classifying problems, 851
NP-hard problems, 858
NP search problems
difficult, 837
easy, 837
nondeterminism, 835
overview, 833
solutions, 835
subset sum, 834
TSP problem, 862
vertex cover problem, 834, 842
0/1 ILP problem, 835
Null calls, 312
Null keys in symbol tables, 626
Null links in BSTs, 640
Null nodes in linked lists, 571–572
null
keyword, 415
Null transitions in NFAs, 744–746
Null values in symbol tables, 626
NullPointerException
, 370
Numbers
conversions, 21, 67–69, 880–881
intractability, 827
Numerical integration, 449
Nyquist frequency, 161
Object-oriented programming
data types. See Data types
description, 254
overview, 329
Objects
arrays, 365
Complex, 404
memory, 514
names, 362
orphaned, 366
type conversions, 339
uninitialized variables, 339
Occam’s Razor, 814
Octal representation, 898
Odd parity function
sum-of-products circuits, 1026
truth tables for, 1026
Off-by-one errors, 92
Offscreen canvas, 151
Offset binary representation, 889
On computable numbers, with an application to the Entscheidungsproblem article, 717
On/off switches, 1005
One-dimensional arrays, 90
One-hot OR gates, 1023
Onscreen canvas, 151
Opcodes, 911
Operands, 17
Operators and operations
compound assignments, 60
description, 15
floating-point numbers, 24
lambda, 450
overloading, 416
precedence, 17
reverse Polish notation, 590
stacks, 590
TOY machine, 906
Optimal data compression, 814
Optimization
NP problems, 835
premature, 518
Optimizing compilers, 814
Or operation
TOY machine, 913
Order statistics, 651
Order-of-growth classifications
constant, 503
linearithmic, 504–505, 507–508
logarithmic, 503
overview, 503
Ordered operations
binary search trees, 651
symbol tables, 624
Orphaned objects, 366
Orphaned stack items, 581
Outer loops, 62
Outline shapes, 149
arithmetic logic units, 1032
data types, 353
file concatenation, 356
gates, 1013
print statements, 8
standard drawing. See Standard drawing
stream data types, 355
two-dimensional arrays, 107
Overflow
arithmetic, 885
arrays, 95
attacks, 963
guarding against, 898
integers, 23
negative numbers, 38
Overhead for objects, 514
Overloading
operators, 416
static methods, 198
Overriding methods, 452
The P= NP Question and Gödel’s Lost Letter book, 856
P search problems, 837
examples, 839
Padding object memory, 514
Page, Lawrence, 184
Palindromes
description, 719
Watson–Crick, 374
Paper size, 294
Papert, Seymour, 400
Parallel arrays, 411
Parallel edges, 676
Parameter variables
lambda expressions, 450
Parameterized data types, 582–586
Parameters
in performance, 511
TOY-8 machine, 1070
Parentheses ()
casts, 33
lambda expressions, 450
operator precedence, 17
regular expressions, 724
static methods, 196
vectors, 442
Parity in ripple–carry adders, 1028
Parsing
Pascal’s triangle, 125
Passing arguments
PathFinder
program, 683–686, 690–692
Paths
intractability problems, 829
shortest. See Shortest paths
simple, 710
Pattern
class for REs, 763
PCs. See Program counters (PCs)
PDA (pushdown automata), 755–756
PDP-8 computers, 906
Peaks in terrain analysis, 167
Pell’s equation, 869
Pens
color, 150
drawings, 146
Pepys, Samuel, 88
Pepys problem, 88
Percent signs (%
)
Percolation case study
PercolationProbability
, 310–311
PercolationVisualizer
, 308–309
probability estimates, 310–311
binary searches, 535
importance, 702
mergesort, 553
multiple parameters, 511
perspective, 518
shortest paths, 690
wrapper types, 369
Periods (.
)
classes, 227
regular expressions, 724
Permutations
inverse, 122
Phase transitions, 317
Phone books, 628
Photographs, 346
Physical systems, graphs for, 672
Piecewise approximation, 148
connecting programs, 141
Pixels in image processing, 346
Plasma clouds, 280
Playing card possibilities, 823
PlayThatTuneDeluxe
program, 213–215
Plotting
percolation case study, 314–318
sound waves, 249
Plus signs (+
)
compound assignments, 60
integers, 22
regular expressions, 731
Pointers
array elements, 94
handles, 371
object references, 338
safe, 366
Poisson processes, 597
Polar coordinates, 47
Polling, statistical, 167
Polymorphism, 448
Polynomial time, 823
Polynomial-time algorithms
usefulness, 858
Polynomial-time reductions, 841–843
Pop operation
reverse Polish notation, 590–591
Positional notation, 875
Post correspondence problem, 813–814
Postconditions in assertions, 467
Postfix notation, 590
Postorder tree traversal, 649
PotentialGene
program, 336–337
Pound signs (#
), 769
Precedence
arithmetic operators, 17
regular expressions, 724
Precision
floating-point numbers, 25, 40
Precomputed array values, 99–100
Preconditions in assertions, 467
Prediction, performance, 507–509
Preferred attachment process, 713
Prefix-free strings, 564
Premature optimization, 518
Preorder tree traversal, 649
Primality-testing function, 198–199
Prime numbers
Sieve of Eratosthenes, 103–105
Primitive data types, 14
memory size, 513
overflow checking, 39
performance, 369
wrappers, 457
Principle of superposition, 483
print()
method, 31
impurity, 32
Out
, 355
vs. println()
, 8
Print statements, 5
println()
method, 31
description, 5
impurity, 32
Out
, 355
vs. print()
, 8
string concatenation, 20
private
keyword
access modifier, 384
encapsulation, 433
Probability density function, 202–203
Problem reduction
overview, 811
program equivalence, 812
Problem size in intractability, 824
Procedural programming style, 329
connections and timing, 1075
interfaces, 1073
modules, 1073
overview, 1073
TOY machine, 910
Program equivalence problem, 812
Programming environments, 1094
indexing, 634
stack-based, 590
symbol tables, 629
Programming overview, 1
Programs
connecting, 141
processing programs, 788–790, 964–966
Proof by contradiction, 754
Pseudo-code, 911
public
keyword
access modifiers, 384
description, 228
static methods, 196
Pulses, clock, 1058
Punched cards, 940
Pure functions, 201
Pure methods, 32
Push operation
reverse Polish notation, 590–591
Pushbuttons for TOY machine, 916
Put operations
hash tables, 639
symbol tables, 624
Putnam, Hilary, 816
Quad play, 273
Quadratic Koch island fractal, 803
Quadratic order of growth, 504–505, 507–508
Quadrature integration, 449
Quaternions, 424
Question marks (?) in REs, 731
Queue
program, 592–596, 604–605
circular, 620
deques, 618
FIFO. See First-in first-out (FIFO) queues
overview, 566
random, 596
summary, 608
Quotes (") in text, 5
Race conditions in flip-flops, 1050
Ragged arrays, 111
Ramanujan, Srinivasa, 86
Ramanujan’s taxi, 86
Random graphs, 695
Random numbers
function implementation, 199
Gaussian, 47
impurity, 32
Random queues, 596
Random shortcuts, 699
Brownian bridges, 278
two-dimensional, 86
undirected graphs, 712
Random web surfer case study
histograms, 177
input format, 171
Ranges
binary search trees, 651
functions, 192
Ranks
binary search trees, 651
Raphson, Joseph, 65
Raster images, 346
Receivers in cryptography, 992
Recognition problem
formal languages, 722
Rectangle rule, 449
Recurrence relations, 272
Recursion, 191
base cases, 281
binary searches, 533
considering, 320
linked lists, 571
mathematical induction, 266
memory requirements, 282
mergesort, 550
percolation case study, 312–314
perspective, 289
Red–black trees, 648
Redirection, 139
Reduced instruction set computing (RISC), 974
Reductio ab absurdum, 808
Reduction
binary search trees, 640
mergesort, 554
References
accessing, 339
aliasing, 363
arrays, 365
garbage collection, 367
linked lists, 572
memory, 367
method, 470
object-oriented programming, 330
orphaned objects, 366
performance, 369
safe pointers, 366
Reflexive property, 454
Registers
implementing, 1052
machine language, 931
computational biology, 732–734
recognition problem, 728–729, 735, 753
validity checking, 732
Regular languages, 723
regular expressions. See Regular expressions (REs)
Reject states
Relays in circuit models, 1006
Removing
array items, 569
collection items, 566, 602–603
NFA nodes, 751
set keys, 652
Rendell, Paul, 805
Repetitive code, simplifying, 100
Representation in APIs, 431
overview, 874
summary, 896
Reproducible experiments, 495
Reserved words, 16
Resetting flip-flops, 1050
ResizingArrayStackOfStrings
program, 578–581
Resource allocation
graphs for, 673
Resource-sharing systems, 606–607
Return addresses, 931
return
statements, 194, 196, 198
Return values
arrays as, 210
methods, 30, 196, 200, 207–210
reverse Polish notation, 591
Reverse Polish notation, 590
RGB color format, 48–49, 341, 371
Rice, Henry, 812
Riemann integral, 449
Riffle shuffles, 125
Right shift operations
TOY machine, 913
Right subtrees, 640
Right triangles, 199
Ring buffers, 620
Ripple–carry adders, 1028–1030
RISC (reduced instruction set computing), 974
Robinson, Julia, 816
Roots in binary search trees, 640
Rotation filters, 379
Roulette-wheel selection, 174
Round-robin policies, 606
RR-format instructions, 911
Run-time errors, 6
Running time. See Performance
Running virtual machines, 969
RuntimeException
, 466
Safe pointers, 366
Sample standard deviation, 246
Sample variance, 244
Sampling
function graphs, 148
SAT problem, 832
nondeterministic TM, 836
NP-completeness, 844–846, 853–856
Satisfiability, 830
integer linear inequality, 831
linear equation, 830
linear inequality, 831
NP-completeness, 844–846, 853–856
Saving audio files, 157
Scaling
drawings, 146
Scientific computing, 1094
Scientific notation
Search problems
easy, 837
nondeterminism, 836
overview, 833
solutions, 835
subset sum, 834
TSP problem, 862
vertex cover problem, 834, 842
binary. See Binary searches
binary search trees. See Binary search trees (BSTs)
bisection, 537
breadth-first, 683, 687–688, 690, 692
indexing, 634
overview, 532
for similar documents, 464
Secret messages, 992
Seeds for random numbers, 475
Select control lines, 1056
Self-avoiding walks, 112–115, 710
Self-loops for edges, 676
SelfAvoidingWalk
program, 112–115
Semantics, 52
Semicolons (;
)
for
loops, 59
statements, 5
description, 1008
overview, 1048
Server farms, 976
Servers, 606
Sets
elementary functions, 1001
gates, 1045
graphs, 676
Julia, 427
of values, 14
Setting flip-flops, 1050
Shadow variables, 419
Shannon entropy, 378
Shapes, outline and filled, 149
Shifts
circular, 375
linear feedback shift registers (LFSRs), 1000–1001
TOY machine, 913
short
data type, 24
Shortcuts in ring graphs, 699
adjacency-matrix, 692
breadth-first searches, 690
degrees of separation, 684–686
implementation, 691
performance, 690
single-source clients, 684
Shuffling arrays, 97
Sicherman dice, 259
Side effects
assertions, 467
importance, 217
Sieve of Eratosthenes, 103–105
Sign-and-magnitude, 886
Sign extension convention, 899
Signatures
constructors, 385
overloading, 198
Similarity measures, 462
Simple paths, 710
Simplex method, 831
Simulations
dice, 121
n-body. See N-body simulation
Single-line comments, 5
Singles quotes (’), 19
Singly linked lists, 571
Sipser, Michael, 780
Six degrees of separation, 670
Size
binary search trees, 651
modules, 319
paper, 294
symbol tables, 624
Sketches
hashing, 460
Slashes (/
)
comments, 5
Small-world case study. See Graphs
Small-world phenomenon, 670, 693
SmallWorld
program, 696
Smith–Waterman algorithm, 286
Social network graphs, 672
Arrays.sort()
, 559
lessons, 558
overview, 532
P search problems, 839
Sound. See Standard audio
Sound waves
plotting, 249
Source vertices, 683
Space-filling curves, 425
Spaces, 10
Sparse matrices, 666
Sparse small-world graphs, 693
Sparse vectors, 666
Specification problem
APIs, 430
formal languages, 722
programs, 596
Speed
clocks, 1058
Spider traps, 176
Spira mirabilis, 398
Spirographs, 167
Spreadsheets, 108
Square brackets ([]
)
regular expressions, 731
Square roots
double
value, 25
Squaring Markov chains, 179–180
SR flip-flops, 1050
Stable circuits with feedback, 1049
StackOfStrings
program, 568
StackOverflowError
, 282
arithmetic expression evaluation, 586–589
overview, 566
stack-based languages, 590
summary, 608
concert A, 155
notes, 156
overview, 155
saving files, 157
summary, 159
Standard deviation, 246
double buffering, 151
function graphs, 148
outline and filled shapes, 149
summary, 159
text and color, 150
Standard input
formatted, 135
multiple streams, 143
summary, 159
typing, 134
Standard output
description, 127
multiple streams, 143
summary, 159
Standards, API, 429
Start codons, 336
Statements
assignment, 17
blocks, 50
methods, 5
States
objects, 340
virtual machines, 968
arguments, 197
for code organization, 205–206
function-call traces, 195
function calls, 197
implementation examples, 199
vs. instance, 340
libraries. See Libraries
overloading, 198
Side effects, 201
summary, 215
superposition example, 211–215
variable scope, 200
Static variables, 284
Statistical polling, 167
StdAudio
library, 128–129, 155
StdDraw
library, 128–129, 144–145, 150, 154
StdIn
library, 128–129, 132–133
Stop codons, 336
Stored-program computers, 922–924
Streams
output, 355
Stress testing, 236
alphabet symbols, 718
circular shifts, 375
input, 133
internal storage, 37
invoking instance methods, 334
memory, 515
overview, 331
prefix-free, 564
as sequence of characters, 19
string replacement systems, 795
unions, 723
variables, 333
vertices, 675
Strogatz, Stephen, 670, 693, 713
Structured programming, 926
Stub methods, 303
Subclassing inheritance, 452–457
Subgraphs, induced, 705
Subset sum problem
Subtraction
integers, 22
negative numbers, 887
Subtyping inheritance, 446–451
Sum-of-powers conjecture, 89
Sum-of-products
adders, 1028
boolean representation, 996–997
Superclasses, 452
Superposition
force vectors, 483
Swirl filters, 379
Switch control lines, 1005
Switches
bus muxes, 1036
circuit models, 1002, 1005–1006
demultiplexers, 1022
gates, 1013
multiplexers, 1020
Switching circuit analysis, 1007
Switching time of gates, 1013
BSTs. See Binary search trees
graphs, 676
machine language, 944
perspective, 654
Symbolic names in assembly, 981
Symbols
definition, 757
DFA, 738
NFA, 744
regular expressions, 724
Symmetric order in BSTs, 640
Symmetric property, 454
Tables
symbol. See Symbol tables
Tabs
compiler considerations, 10
escape sequences, 19
Tape and tape readers
Turing machines, 766–769, 774–776
Tape
program, 776
Taylor series approximations, 204
Templates, 50
Terminal windows, 127
Terms, glossary for, 1097–1101
Terrain analysis, 167
Testing
for bugs, 318
importance, 701
percolation case study, 305–308
Text. See also Strings and String
data type
drawings, 150
Text editors, 3
this
keyword, 445
Thompson, Ken, 735
Thue word problem, 819
Ticks, clock, 1058
Tilde notation, 500
Tildes (~
)
bitwise operations, 891
boolean type, 991
frequency analysis, 500
Time
performance. See Performance
polynomial, 823
TimePrimitives
program, 519
Timesharing, 965
Tools, building, 320
Top-level domains, 375
toString()
method
Color
, 343
description, 339
Object
, 453
Sketch
, 459
Tape
, 776
Vector
, 443
Total orderings, 546
Towers of Hanoi problem, 268–272
arithmetic logic unit, 910
conditionals and loops, 918–921
fetch–increment–execute cycle, 910–911
instruction register, 910
machine-language programming. See Machine-language programming
program counter, 910
registers, 909
stored-program computer, 922–924
virtual. See Virtual machines
TOY
program, 967
basic parameters, 1070
sum.toy
program, 1071–1072, 1082–1083
Tracing
function-call, 195
programs with random()
, 103
Transistors, 1006
Transitions
Transitive property
comparisons, 546
equivalence, 454
polynomial-time reduction, 843
Transposition of arrays, 120
Traveling salesperson problem, 862
Traversal
TreeMap
library, 655
Tree nodes, 269
Trees
BSTs. See Binary search trees
Triangles
right, 199
Trigonometric functions, 256
TSP problem, 862
Turing, Alan, 766
code breaking, 907
von Neumann influenced by, 924–925
Turing-complete models, 794
Turing machines
binary adders, 771
compact trace format, 770
constant factor, 824
efficiency, 772
overview, 766
SAT problem, 836
universal virtual DFAs, 789
universality. See Universality
TuringMachine
program, 777–778
Twenty questions game, 135–136, 533–535
TwentyQuestions
program, 135–136
description, 90
output, 107
overview, 106
ragged, 111
setting values, 108
spreadsheets, 108
Type parameters, 585
Type safety, 18
Types. See Data types
Undirected graphs, 675
Unicode characters
description, 19
strings, 37
Uniform random numbers, 199
Uninitialized variables, 94, 339
Union operation in REs, 723
Unit testing, 235
Universal sets
elementary functions, 1001
gates, 1045
Universal Turing machines (UTMs), 789–790
Universal virtual DFAs, 741–743
Universal virtual TMs, 774–779
overview, 786
programs processing programs, 788–790
Turing machine variations, 791–794
Unreachable code error, 216
Unsigned integers, 884
Unsolvability proof, 810
Unsolvable problems, 430
blank tape halting problem, 820
definite integration, 816
description, 806
examples, 815
Hilbert’s 10th problem, 816
optimal data compression, 814
optimizing compilers, 814
program equivalence, 812
Upper bounds, 825
Upscaling in image processing, 349
User-defined libraries, 230
UTF-8 encoding, 895
Validate
program, 729
Validity checking, 732
Values
passing arguments by, 207, 210, 364–365
Variables
assignment statements, 17
compound assignments, 60
constants, 16
initial values, 415
inline initialization, 18
instance, 384
names, 16
shadow, 419
static, 284
string, 333
tracing values, 18
uninitialized, 339
Vector images, 346
Vectors
arrays, 92
cross products, 472
matrix–vector multiplication, 110
sparse, 666
vector–matrix multiplication, 110, 180
Vertex cover problem
intractability, 828
Vertical bars (|
)
piping, 141
regular expressions, 724
Vertical OR gates, 1023
Vertices
bipartite graphs, 682
creating, 676
eccentricity, 711
isolated, 703
names, 675
PathFinder
, 683
String
, 675
and cloud computing, 924
description, 965
Moore’s law, 971
programs that process programs, 964–966
running, 969
states, 968
universal virtual DFAs, 742
Viruses, 963
Viterbi algorithm, 286
Volatility
Black–Scholes formula, 565
Von Neumann, John, 906
ballistics tables, 907
Gödel letter, 840
mergesort, 554
Von Neumann architecture, 790, 906, 924–925
Voting machine errors, 436
Walks
random. See Random walks
Watson–Crick palindrome, 374
Watts–Strogatz graph model, 713
.wav
format, 157
Wave filters, 379
Web graphs, 695
Web pages, 170
indexes searches, 634
preferential attachment, 713
Weighted averages, 120
Weighted superposition, 212
examples, 61
nesting, 62
Whitelists, binary searches for, 540
Whitespace characters
compiler considerations, 10
input, 135
Wide interfaces
APIs, 430
Wildcard operation in REs, 724
Wiles, Andrew, 722
Wind chill, 47
Wires
gates, 1013
Word ladders, 710
Words
binary representation, 875
computer, 874
memory size, 513
size, 897
Worst-case performance
binary search trees, 648
description, 512
insertion sort, 544
intractability, 825
NP-completeness, 852
Wrapper types
Write control lines
memory bits, 1056
register bits, 1051
XOR circuits
in arithmetic logic units, 1031
xor (exclusive or) operation, 891–892, 913
Young tableaux, 530
Zero-based indexing, 92
Zero crossings, 164
Zero extension convention, 899
vertex cover problem, 842
Zeros, leading, 883
ZIP codes, 435
Zipf’s law, 556