Algorithm Design and Analysis
Tandy J. Warnow · 2017
This appendix provides necessary background in algorithm design and analysis, and in proving algorithms correct. It covers techniques for computing the running time of an algorithm, the standard “Big-O” notation, what it means for a problem to be NP-hard or NP-complete, and for a problem to be polynomial time. However, the material in this appendix is not meant as a substitute for undergraduate courses in discrete mathematics and algorithm design and analysis, but rather to provide some of the material that the reader needs to know. We recommend that readers without sufficient background in this area consult other textbooks for background material. Discrete Mathematics Graph Theory A graph G consists of a set V of vertices and a set E of edges, where the edges are unordered pairs of vertices; we often write graphs using notation G = ( V,E ). The edges of a simple graph are always distinct (thus, there are no self-loops, which are edges between a vertex and itself), and no parallel edges (two edges with the same endpoints). In this text, we will only discuss simple graphs. Two vertices that are connected by an edge are said to be adjacent and the edge that connects them is said to be incident to its vertex endpoints. If a vertex a is adjacent to vertex b , it is said to be a neighbor of b . The degree of a vertex is the number of edges that are incident with the vertex, which is the same as the number of vertices that are neighbors of the vertex. A path in a graph is a sequence of vertices v 1 , v 2 , …, vk so that vi is adjacent to vi +1 for each i = 1 , 2 , …, k− 1, with the assumption that no two vertices are the same except perhaps v 1 and vk . A path in which any vertex can be repeated is called a walk . A graph for which every two vertices are connected by a path is said to be connected . The maximal connected subgraphs of a graph are called the components of the graph.