Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
courses:cs211:winter2011:journals:charles:home [2011/01/26 04:59] – gouldc | courses:cs211:winter2011:journals:charles:home [2011/04/05 05:20] (current) – gouldc | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Charles' | ====== Charles' | ||
- | PREFACE | ||
- | |||
- | Algorithms are pervasive both within and beyond computer science. Understanding algorithms gives a glimpse into the whole of computer science. | ||
- | Two fundamental components of algorithm analysis: determining its mathematical core, identifying an appropriate design. | ||
- | The book builds upon prior knowledge of data structures and programming. It is meant to be read by students who have taken introductory courses in the discipline. | ||
- | A good portion of the book will be dedicated to the notion of computational intractability. We will see that problems can be proved to be NP-complete, | ||
- | |||
- | CHAPTER ONE -- INTRODUCTION: | ||
- | |||
- | 1.1 A First Problem: Stable Matching | ||
- | |||
- | The problem of stable matching is best explained using an example. In class we used bachelors and bachelorettes. Suppose some man m is engaged to some woman w, and another man m' is engaged to another woman w'. Now, suppose that m prefers w' to w, and w' prefers to m to m'. It would be preferable for m and w' to break their engagements, | ||
- | |||
- | 1.2 Five Representative Problems | ||
- | |||
- | (1) Interval scheduling | ||
- | |||
- | And then ITS decreed, " | ||
- | |||
- | (2) Weighted interval scheduling | ||
- | |||
- | This is similar to the interval scheduling problem; the difference is that each request has an associated value (weight). We no longer want to accept the maximum number of compatible requests. We want to accept the subset of requests that yields the maximum sum value. | ||
- | |||
- | (3) Bipartite matching | ||
- | |||
- | Bipartite graphs can model assignments (likes jobs being assigned to machines). Each job should be matched to a machine, and each machine should be matched to a job. We represent bipartite graphs as two columns of nodes, with edges (assignments) from nodes in the first column to nodes in the second column. The stable matching problem is an example of bipartite matching. More formally, such a problem is defined in the following way: "Given an arbitrary bipartite graph G, find a matching of maximum size. If |X| = |Y| = n, then there is a perfect matching if and only if the maximum matching has size n." | ||
- | |||
- | (4) Independent set | ||
- | |||
- | A set of nodes is independent if no two nodes in S are joined by an edge. Example problem: you have n friends, some pairs don't get along. Find the maximum number of friends you can invite to say a birthday party and avoid any conflicts. Interval scheduling and bipartite matching can both be thought of (encoded) as special cases of the independent set problem. There is no efficient algorithm for the independent set problem currently. We will see later that " | ||
- | |||
- | (5) Competitive facility location | ||
- | |||
- | Walmart vs K-Mart. Both companies want to build stores in convenient locations (to increase market share, etc.). But all around the country, local zoning regulations prevent the franchises from being located too near one another. Assume the geographic region over which they are vying for control is divided into n zones (1, 2, ..., n), and each zone has an associated value (the expected revenue for each company if it opens a store there). Who will win the game? Which company will open a store in location X, Y, Z? | ||
- | |||
- | CHAPTER TWO -- BASICS OF ALGORITHM ANALYSIS | ||
- | |||
- | 2.1 Computational Tractability | ||
- | |||
- | "[Many of the problems we study] will involve an implicit search over a large set of combinatorial possibilities, | ||
- | |||
- | 2.2 Asymptotic Order of Growth | ||
- | |||
- | As input size grows, the worst-case running time grows at a rate proportional to some function f(n). This function becomes a BOUND on the running time of the algorithm. | ||
- | There are three types of asymptotic bounds: upper bounds (big-O), lower bounds (omega), and tight bounds (theta). Asymptotic growth rates have the properties of additivity and transitivity. Some propositions/ | ||
- | Polynomials are O(n^2), logarithms are O(log n), and exponentials are O(r^n). | ||
- | |||
- | 2.3 Implementing the Stable Matching Algorithm Using Lists and Arrays | ||
- | |||
- | The Gale-Shapley Stable Matching algorithm terminates in at most n^2 iterations (we learned this earlier). It would be nice to construct an algorithm that is O(n^2). For this to work, every iteration has to be implemented in constant time. It is important for programmers to consider the data structures they will be using; they are chosen for efficiency and for ease of implementation. The G-S algorithm can be implemented using arrays and linked lists. A section is dedicated to an overview of these data structures (including their advantages and disadvantages) but we know about them by now. | ||
- | |||
- | 2.4 A Survey of Common Running Times | ||
- | |||
- | |||
- | |||
- | 2.5 A More Complex Data Structure: Priority Queues | ||
- | |||
- | |||
+ | * [[preface|Preface]] | ||
+ | * [[chapter1|Chapter 1: Introduction]] | ||
+ | * [[chapter2|Chapter 2: Algorithm Analysis]] | ||
+ | * [[chapter3|Chapter 3: Graphs]] | ||
+ | * [[chapter4|Chapter 4: Greedy Algorithms]] | ||
+ | * [[chapter5|Chapter 5: Divide and Conquer]] | ||
+ | * [[chapter6|Chapter 6: Dynamic Programming]] | ||
+ | * [[chapter7|Chapter 7: Network Flow]] |