INTRODUCTION
Objective: Algorithms Techniques Analysis.
Algorithms: Definition: An algorithm is a sequence of computational steps that take some value, or set of values, as input and produce some value, or set of values, as output. Pseudocode: An easy way
NP-Complete Theory
http:/www.seas.gwu.edu/~ayoussef/cs212/npcomplete.html
P-Complete Theory I. Introduction II. Definition of P III. Focus on Yes- o Problems IV. Reductions and Transforms V. P-Completeness I. Introduction
A problem is said to be polynomia
Graph Search Techniques
http:/www.seas.gwu.edu/~ayoussef/cs212/graphsearch.html
Graph Search Techniques I. Introduction II. Tree Traversal Techniques III. Depth-First Search IV. Breadth-First Search V. Biconnectivity: A Major Application of DFS I. Introdu
Divide and Conquer
http:/www.seas.gwu.edu/~ayoussef/cs212/divide-and-conquer.html
I. Template for Divide and Conquer II. First Application: Mergesort III. Second Application: Quicksort IV. First Application: Order Statistics
I. Template for Divide and Con
$FILE
http:/www.seas.gwu.edu/~ayoussef/cs212/datastructures.html
Data Structures
1. What is a data structure? An organization of a data set Several operations to be performed on the data set 2. The general problem of data structure design Input: a data se
CS 212 Design and Analysis of Algorithms
http:/www.seas.gwu.edu/~ayoussef/cs212/
CS 212 Design and Analysis of Algorithms
Summary
Design and analysis of algorithms using six algorithmic design techniques: divide-and-conquer, greedy method, dynamic program
Branch and Bound
http:/www.seas.gwu.edu/~ayoussef/cs212/branchandbound.html
Branch and Bound I. Introduction II. Illustration on the Job Assignment Problem III. The General Branch and Bound Algorithm IV. Criteria for the Choice of Approximate Cost Functio
Backtracking
http:/www.seas.gwu.edu/~ayoussef/cs212/backtracking.html
Backtracking I. Introduction II. Formulation of the Problem of Generating Combinatorial Objects III. The General Backtracking Algorithm IV. Implementations for the Eight Applications I.
Np-complete
Introduction:
There are two types of problems:
Problems whose time complexity is polynomial: O(logn), O(n), O(nlogn), O(n 2), O(n 3) Examples: searching, sorting, merging, MST, etc. Problems with exponential time complexity: O(2n), O(n!), O
Greedy Method
Objective: General approach:
Given a set of n inputs. Find a subset, called feasible solution, of the n
inputs subject to some constraints, and satisfying a given objective function. If the objective function is maximized or minimized, the
Graph Search Techniques
1- Tree search: Inorder (L N R) Preorder (N L R) Postorder (L N R).
2- Graph search: Given a graph G. Depth-first-search DFS (v) Begin Visited (v) =1; For every node w adjacent to v do If visited (w) = o then DFS (w); End if End fo
Dynamic Programming
Objective:
Dynamic programming is applied to optimization
problems.
Comparison
Divide-and-conquer algorithms partition the problem
into independent sub problems.
Greedy method generates a single decision "locally
optimal", at each
Divide & Conquer
Introduction: It is primarily a recursive method. The divide-and-conquer strategy consists: in breaking a problem into simpler subproblems of the same type, next to solve these subproblems, and finally to merge the obtained results into a
Priority Queue: Heap Structures
F Definition: max-heap (min-heap) is a complete BT with the property A that the value (priority) of each node is at least as large (small) as the values at its children (if they exist).
F Implementation: equential represent
Branch and Bound
Definitions:
Similar to backtracking technique BFS-like search for solutions Uses a search tree E-node Live-node Solution-node Dead-node
Requirements
Branching: A set of solutions, which is represented by a
node, can be partitioned i
Backtracking
Examples:
Maze problem
Finish
Start
The bicycle lock problem:
Consider a lock with N switches, each of which can be either 0 or 1. We know that the combination that opens the lock
N should have at least 1's. 2
Note: The total number of
The Greedy Method
http:/www.seas.gwu.edu/~ayoussef/cs212/greedy.html
1. 2. 3. 4. 5. 6.
Greedy Template First Application: Selection Sort Second Application: Optimal Merge Patterns Third Application: The Knapsack Problem Fourth Application: Minimum Spannin