Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 256 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
256
Dung lượng
1,93 MB
Nội dung
Mathematics for Algorithm and System Analysis for students of computer and computational science Edward A Bender S Gill Williamson c Edward A Bender & S Gill Williamson 2005 All rights reserved Preface Discrete mathematics is an essential tool in almost all subareas of computer science Interesting and challenging problems in discrete mathematics arise in programming languages, computer architecture, networking, distributed systems, database systems, AI, theoretical computer science, and other areas The course The University of California, San Diego, has a lower-division two-quarter course sequence in discrete mathematics that includes Boolean arithmetic, combinatorics, elementary logic, induction, graph theory and finite probability These courses are core undergraduate requirements for majors in Computer Science, Computer Engineering, and Mathematics-Computer Science This text, Mathematics for Algorithm and System Analysis, was developed for the second quarter and A Short Course in Discrete Mathematics was developed for the first quarter Because some students transfer into the second quarter of the course without having taken the first quarter, there is some overlap between the two texts and, with appropriate students, this text could be used without the first This book consists of four units of study (Counting and Listing—CL; Functions— Fn; Decision Trees and Recursion—DT; and Basic Concepts of Graph Theory—GT), each divided into four sections Each section contains a representative selection of problems These vary from basic to more difficult, including proofs for study by mathematics students or honors students The first three sections in units CL and Fn are primarily a review of material in A Short Course in Discrete Mathematics needed for this course The review questions “Multiple Choice Questions for Review” appear at the end of each unit The explanatory material in this book is directed towards giving students the mathematical language and sophistication to recognize and articulate the ideas behind these questions and to answer questions that are similar in concept and difficulty Many variations of these questions have been successfully worked on exams by most beginning students using this book at UCSD Students who master the ideas and mathematical language needed to understand these review questions gain the ability to formulate, in the neutral language of mathematics, problems that arise in various applications of computer science This skill greatly facilitates their ability to discuss problems in discrete mathematics with other computer scientists and with mathematicians iii Table of Contents Asterisks (stars) are used in the text to mark more difficult material that is not needed in later sections Unit CL: Basic Counting and Listing Section 1: Lists with Repetitions CL-1 set, list, multiset, sequence, word, permutation, k-set, k-list, k-multiset, k-lists with repetition, rule of product, Cartesian product, lexicographic order (lex order), dictionary order, rule of sum, composition of a positive integer Section 2: Lists Without Repetition CL-9 k-lists without repetition, Stirling’s formula for approximating n!, circular arrangements, words from a collection of letters Section 3: Sets CL-13 set intersection, set union, set difference, set complement, symmetric difference, set product (Cartesian product), binomial coefficients, generating functions, binomial theorem, full house (card hand), two pairs (card hand), rearranging words, multinomial coefficients, card hands and multinomial coefficients, recursions, set partitions, Stirling numbers of the second kind (S(n, k)), straight (card hand), Bell numbers Bn Section 4: Probability and Basic Counting CL-28 sample space, selections done uniformly at random, event, probability function, combining events, Venn diagrams, odds, hypergeometric probabilities, fair dice, geometric probability, principle of inclusion exclusion, birthday problem Multiple Choice Questions for Review CL-41 Unit Fn: Functions Section 1: Some Basic Terminology Fn-1 direct product, intersection, union, symmetric difference, domain, range, codomain, one-line notation, surjection, onto, injection, one-to-one, bijection, permutation, relation, functional relation, two-line notation Section 2: Permutations Fn-7 composition, cycle, cycle form of permutation, involution, permutation matrices, derangements v Section 3: Other Combinatorial Aspects of Functions Fn-14 image, inverse image, coimage, image size and Stirling numbers, strictly increasing, strictly decreasing, weakly increasing, weakly decreasing, monotone, multisets, lists without repetition, restricted growth functions and partitions Section 4: Functions and Probability Fn-21 random variable, probability function, event, probability distribution function, expectation, covariance, variance, standard deviation, correlation, independent events, independent random variables, product spaces, generating random permutations, joint distribution function, marginal distributions, binomial distribution, Poisson distribution, normal distribution, standard normal distribution, cumulative distribution, central limit theorem, normal approximation to binomial, Poisson approximation to binomial, Tchebycheff’s inequality Multiple Choice Questions for Review Fn-41 Unit DT: Decision Trees and Recursion Section 1: Basic Concepts of Decision Trees DT-1 decision trees, vertices, root, edges, degree of vertex, down degree, child, parent, leaves, internal vertex, height of leaf, path to vertex, traversals of decision tree, depth first vertices, depth first edges, breadth first, preorder, postorder, lengthfirst lex order, dictionary order, permutations in lex order, partial permutation, rank of leaf, direct insertion order for permutations, backtracking, Latin squares, domino coverings, strictly decreasing functions, unlabeled balls into boxes, isomorph rejection Section 2: Recursive Algorithms DT-15 recursive algorithm, simplest case reduction, recursive algorithm for 0-1 sequences, sorting by recursive merging, recursive approach, recursive solutions, local description for permutations in lex order, recursive description of Towers of Hanoi, decision tree for Towers of Hanoi, recursion and stacks, configuration analysis of Towers of Hanoi, abandoned leaves and RANK, characteristic functions and subsets, Gray code for subsets, decision tree for Gray code for subsets, local description of Gray code, Towers of Hanoi with four poles Section 3: Decision Trees and Conditional Probability DT-27 conditional probability, independent events, Venn diagrams, probabilities of leaves, probabilities of edges, probabilistic decision trees, decision trees and Bayesian methods, Bayes’ theorem, multiplication theorem for conditional probabilities, sequential sampling, the SAT problem, first moment method, tournaments, gambler’s ruin problem Section 4: Inductive Proofs and Recursive Equations DT-40 induction, recursive equations, induction hypothesis, inductive step, base case, prime factorization, sum of first n integers, local description, recurrence relation, vi binomial coefficients C(n, k), Stirling numbers S(n, k), guessing solutions to recurrences, linear two term recurrence, constant coefficients, characteristic equation, two real roots, one real root, complex roots, recursion for derangements, Fibonacci recurrence relation, recurrence relation for derangements Multiple Choice Questions for Review DT-52 Unit GT: Basic Concepts in Graph Theory Section 1: What is a Graph? GT-1 computer network example, simple graph, graph, vertices, edges, set theoretic description of graph, pictorial description of a graph, incidence function, vertices joined by an edge, adjacent vertices, edge incident on a vertex, simple graphs are graphs, form of a graph, equivalence relations, equivalence classes, blocks, binary relations, reflexive, symmetric, transitive, equivalent forms, isomorphism of graphs, graph isomorphism as an equivalence relation, degree of a vertex, loops, parallel edges, isolated vertices, degree sequences and isomorphism, random graphs Section 2: Digraphs, Paths, and Subgraphs GT-13 flow of commodities, directed graph, digraph, simple digraph, simple graphs as simple digraphs, directed loops, digraphs and binary relations, symmetric binary relations and simple graphs with loops, complete simple graphs, path, trail, walk, vertex sequence, walk implies path, restrictions of incidence functions, subgraphs, subgraph induced by edges, subgraph induced by vertices, cycles, connected graphs, connected components and equivalence classes, connectivity in digraphs, Eulerian trail, Eulerian circuit, Hamiltonian cycle, Hamiltonian graph, bicomponents of graphs, bipartite graphs, oriented simple graphs, antisymmetry, order relations, Hasse diagrams, covering relations, counting trees Section 3: Trees GT-24 tree, alternative definitions of a tree, rooted graph, rooted tree, parent, child, sibling, leaf, internal vertices, unique paths in trees, rooted plane tree, RP-tree, traversing RP-trees, depth first sequences, breadth first sequences, spanning trees, minimum spanning trees, greedy algorithms, Prim’s algorithm, Kruskal’s algorithm, lineal or depth-first spanning trees, algorithm for depth-first spanning trees, bipartite graphs and depth first spanning trees, degree sequences of trees, binary trees, full binary trees, height and leaf restrictions in binary trees Section 4: Rates of Growth and Analysis of Algorithms GT-37 comparing algorithms, machine independence, example of finding the maximum, Θ notation, O notation, properties of Θ and O, Θ as an equivalence relation, sufficiently large, eventually positive, asymptotic, “little oh” notation, using Θ to compare polynomial evaluation algorithms, average running time, tractable, intractable, graph coloring problem, traveling salesman problem, clique problem, N P -complete problems, N P -hard, N P -easy, chromatic number of a graph, almost good algorithms, almost correct algorithms, close algorithms, polynomial time, exponential time, Θ and series, Θ and logs vii Multiple Choice Questions for Review GT-51 Solutions to Exercises Notation Index Subject Index viii Unit CL Basic Counting and Listing Section 1: Lists with Repetitions We begin with some matters of terminology and notation Two words that we shall often use are set and list (Lists are also called strings.) Both words refer to collections of objects There is no standard notation for lists Some of those in use are apple banana pear peach apple, banana, pear, peach and (apple, banana, pear, peach) The notation for sets is standard: the items are separated by commas and surrounded by curly brackets as in {apple, banana, pear, peach} The curly bracket notation for sets is so well established that you can normally assume it means a set — but beware, some mathematical software systems use { } (curly brackets) for lists What is the difference between a set and a list? “Set” means a collection of distinct objects in which the order doesn’t matter Thus {apple, peach, pear} and {peach, apple, pear} are the same sets, and the set {apple, peach, apple} is the same as the set {apple, peach} In other words, repeated elements are treated as if they occurred only once Thus two sets are the same if and only if each element that is in one set is in both In a list, order is important and repeated objects are usually allowed Thus (apple, peach) (peach, apple) and (apple, peach, apple) are three different lists Two lists are the same if and only if they have exactly the same items in exactly the same positions Thus, “sets” and “lists” represent different concepts: A list is always ordered and a set has no repeated elements Example (Using the terminology) People, in their everyday lives, deal with the issues of “order is important” and “order is not important.” Imagine that Tim, Jane, and Linda are going to go shopping for groceries Tim makes a note to remind himself to get apples and bananas Tim’s note might be written out in an orderly manner, or might just be words randomly placed on a sheet of paper In any case, the purpose of the note is to remind him to buy some apples and bananas and, we assume, the order in which these items are noted is not important The number of apples and bananas is not specified in the note That will be determined at the store after inspecting the quality of the apples and bananas The best model for this note is a set Tim might have written c Edward A Bender & S Gill Williamson 2005 All rights reserved .. .Mathematics for Algorithm and System Analysis for students of computer and computational science Edward A Bender S Gill Williamson c Edward A Bender & S Gill Williamson 2005 All... repeats can be formed from a 5-set? There are 5! = 120 5-lists without repeats, 5!/1! = 120 4-lists without repeats, 5!/2! = 60 3-lists, 5!/3! = 20 2-lists and 5!/4! = 1-lists By the Rule of Sum,... the sets and lists described above, there is another concept that occurs in both everyday life and in mathematics Suppose Tim, Jane, and Linda happen to go the grocery store and are all standing