Preface
From 1970 to 1990 I ran a graduate seminar on algebraic and algorithmic com-binatorics in the Department of Mathematics, UCSD. From 1972 to 1990 al-gorithmic combinatorics became the principal topic. The seminar notes from1970 to 1985 were combined and published as a book, Combinatorics for Com-puter Science (CCS), published by Computer Science Press. Each of the "unitsof study" from the seminar became a chapter in this book.
My general goal is to re-create the original presentation of these (largely inde-pendent) units in a form that is convenient for individual selection and study.Here, we isolate Unit 1, corresponding to Chapter 1 of CCS, and reconstructthe original very helpful unit specific index associated with this unit.
Theorems, figures, examples, etc., are numbered sequentially: EXERCISE 1.38and FIGURE 1.62 refer to numbered items 38 and 62 of Unit 1 (or Chap-ter 1 in CCS), etc. CCS contains an extensive bibliography for work prior to1985. For further references and ongoing research, search the Web, particularlyWikipedia and the mathematics arXiv (arXiv.org).
These notes focus on the visualization of algorithms through the use of graph-ical and pictorial methods. This approach is both fun and powerful, preparingyou to invent your own algorithms for a wide range of problems.
S. Gill Williamson, 2012http : \www.cse.ucsd.edu\ ∼ gill
iii
Table of Contents for Unit 1
Descriptive tools from set theory..............................................................3relations, equivalence relations, set partitions, image, coimage surjection,injection, bijection, covering relations, Hasse diagrams, exercises and ex-amples.
Basic data structures .................................................................................7exercises, examples, order preserving bijections, hashing tables, linked lists,structural diagrams.
Lexicographic order ................................................................................14colex order, examples lex and colex order, permutations in lex order, in-creasing functions in lex and colex order, Hasse diagrams of products oflex orders, lex bucket sort, tree diagrams for prelex, inlex, postlex orders,length-first lex, tilings of board in lex order, backtracking, 5-queens prob-lem, isomorph rejection, minimal representatitives, soma cube in lex order,dominoe coverings in lex order, examples of isomorph rejection.
Ordered partition trees ...........................................................................24partition trees, local descriptions, partition trees and lex order, partitiontrees for functions, permutations in direct insertion order, lex order bijec-tions for permutations, partition trees for decreasing functions, binomialcoefficients, tree reduction, order isomorphisms for posets, RANK and UN-RANK algorithms.
Examples ..................................................................................................37n-queens problem, orbit refinement, initial and terminal segments of lists.
Subject Index ...........................................................................................47
1
Index
antisymmetric, 3
backtrackingtilings, 19
bucket sort, 15, 16
card sort, 15, 16cardinality, 3characteristic function, 7chessboard
4-queensorbit refinement, 39partition tree, 40
8-queens discussion, 36, 37n-queens
not symmetry recursive, 41search on (n∪{∗})n, 41
general discussion of, 43keys of solution sets, 38orbits
linear order, 37of positions, 37
symmetries of, 37symmetry recursive
examples, 44–46Coimage f ∈ BA
{f−1(b) | b ∈ B}, 5colex order
colexicographic order, 14recursive definition, 15
colexicographic orderfunctions, 14
contents, 1covering relation, 6
data structure
linked list, 9direct access model, 9direct insertion order
permutations, 28coded version, 29edge labels, 29
domino coveringisomorph rejection, 23lex minimal sdr, 23
equivalenceclass, 4class partition, 4
equivalence relationdefinition, 3examples, 5
functioncoimage partition, 5domain, 4image, 4injection, 5inverse image, 4one-line notation, 5range, 4surjection, 5
functions{f | f : A → B} = BA,
4
graph theoryequivalence relations, 5
hashing table, 8Hasse diagram
defined, 6
47
examples, 7
Image f ∈ BA
{f(a) | a ∈ A}, 4integers
bucket notationn = {0, . . . , n−1}, 32
divisibility order, 6positive, 4, 6underline notation{1, . . . , n} = n, 4
isomorph rejectioncube, 23domino covering, 23hexagon, 23orderly algorithms, 42symmetry recursive, 42system of representatives, 42tetrahedron, 23
lex orderinlex, 18length-first, 18lexicographic order, 14permutations, 27postlex, 18prelex, 18
lexicographic orderbucket sort, 15, 16card sort, 15functions, 14injective functions, 14nondecreasing functions, 14one-to-one
functions, 14prelex order, 16product sets, 15recursive definition, 15terminal symbols, 16
linear order, 3as ordered partitions, 23defined, 8lexicographic, 14
products of, 15specified in practice, 8
linked listdoubly linked, 11, 12example, 9of linked lists, 12, 13pointers, 10structural diagram, 10
order isomorphism, 29Sn lex to direct insertion, 30poset, 32predecessor, 30RANK and UNRANK, 32successor, 30
order preserving bijection, 7ordered partition
and words, 23defined, 23refinement, 23tree, 24
ordered setsexamples, 6
partial orderposet, 6
partitionblock, 4discrete, 4equivalence relation, 4ordered defined, 23ordered refinement, 23refinement order, 6set, 4, 6
partition treebinary, 26complete binary, 26contraction of (1.42, 1.44), 26example, 23lex order, 25local description, 25permutations direct insertion,
28
48
permutations lex order, 27permutations
direct insertion order, 28lex order, 27random selection, 35
posetcovering relation, 6order isomorphism defined, 32
preface, iiiprelex order
tree diagram, 17
RANK and UNRANKdecreasing functions, 34, 35defined, 32general disussion, 36random selection, 35
recursionfor D(nk), 31
reflexive, 3relations
antisymmetric, 3covering, 6equivalence, 3linear, 3on matrices, 7order, 3, 6product, 7reflexive, 3symmetric, 3transitive, 3transitive closure 1.13(5), 7
residual treeR(e) of edge, 32general examples, 33
set partition, 4
transitive, 3tree
ordered rooted, 24partition, 24, 26–31residual, 32
terminal vertices - leaves, 24vertices, 24
tree diagramD(64) decreasing, 31D(nk) decreasing, 30S3 direct insertion, 28, 29S3 lex order, 2723 lex order, 26rd local lex order, 25general partition, 24
words5-queens
lex minimal sdr, 21problem defined, 20symmetries, 21
backtracking, 19domino coverings
all 4× 4, 21, 22prelex coding, 21
inherited orders, 18length ≤ d, 18length-first lex (colex), 18postlex order, 18prelex order, 18SOMA cube, 21terminal symbol ∗, 18tiling orders, 19
49