Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 23
Prof. Charles E. Leiserson
Recall from Lecture 22
Flow value: | f | = f (s, V). Cut: Any partition (S, T) of V such that s S and t T. Lemma. | f | = f (S, T) for any cut (S, T). Corollary. | f
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 10
Prof. Erik Demaine
Balanced search trees
Balanced search tree: A search-tree data structure for which a height of O(lg n) is guaranteed when implementing a dynamic set of n items. AVL trees 2-3
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 9
Prof. Charles E. Leiserson
Binary-search-tree sort
T Create an empty BST for i = 1 to n do TREE-INSERT(T, A[i]) Perform an inorder tree walk of T. Example: A = [3 1 8 2 6 7 5] 3 3 1 1 2 2 5 5 6 6
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 8
Prof. Charles E. Leiserson
A weakness of hashing
Problem: For any hash function h, a set of keys exists that can cause the average access time of a hash table to skyrocket. An adversary can pick
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 7
Prof. Charles E. Leiserson
Symbol-table problem
Symbol table T holding n records: x
record
key[x] key[x]
Other fields containing satellite data
Operations on T: INSERT(T, x) DELETE(T, x) SEARCH(T
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 6
Prof. Erik Demaine
Order statistics
Select the ith smallest of n elements (the element with rank i). i = 1: minimum; i = n: maximum; i = (n+1)/2 or (n+1)/2: median. Naive algorithm: Sort and inde
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 5
Prof. Erik Demaine
How fast can we sort?
All the sorting algorithms we have seen so far are comparison sorts: only use comparisons to determine the relative order of elements. E.g., insertion sor
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 4
Prof. Charles E. Leiserson
Quicksort
Proposed by C.A.R. Hoare in 1962. Divide-and-conquer algorithm. Sorts "in place" (like insertion sort, but not like merge sort). Very practical (with tuning)
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 3
Prof. Erik Demaine
The divide-and-conquer design paradigm
1. Divide the problem (instance) into subproblems. 2. Conquer the subproblems by solving them recursively. 3. Combine subproblem solution
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 2
Prof. Erik Demaine
Solving recurrences
The analysis of merge sort from
Lecture 1 required us to solve a
recurrence.
Recurrences are like solving integrals,
differential equations, etc.
o Learn
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 1
Prof. Charles E. Leiserson
Welcome to Introduction to Algorithms, Fall 2001
Handouts
1. 2. 3. 4. 5. 6. Course Information Calendar Registration (MIT students only) References Objectives and Outco
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 11
Prof. Erik Demaine
Dynamic order statistics
OS-SELECT(i, S): returns the i th smallest element in the dynamic set S. OS-RANK(x, S): returns the rank of x S in the sorted order of S's elements. I
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 12
Prof. Erik Demaine
Computational geometry
Algorithms for solving "geometric problems" in 2D and higher. Fundamental objects: Basic structures:
point line segment line
point set
2001 by Erik D.
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 22
Prof. Charles E. Leiserson
Flow networks
Definition. A flow network is a directed graph G = (V, E) with two distinguished vertices: a source s and a sink t. Each edge (u, v) E has a nonnegative
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 21
Prof. Charles E. Leiserson
Take-home quiz
No notes (except this one).
2001 by Charles E. Leiserson
Introduction to Algorithms
Day 35
L21.2
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 20
Prof. Erik Demaine
Disjoint-set data structure (Union-Find)
Problem: Maintain a dynamic collection of pairwise-disjoint sets S = cfw_S1, S2, ., Sr. Each set Si has one element distinguished as t
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 19
Prof. Erik Demaine
Shortest paths
Single-source shortest paths Nonnegative edge weights General DAG
Bellman-Ford: O(VE) One pass of Bellman-Ford: O(V + E) Dijkstra's algorithm: O(E + V lg V)
All
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 18
Prof. Erik Demaine
Negative-weight cycles
Recall: If a graph G = (V, E) contains a negativeweight cycle, then some shortest paths may not exist. . Example: <0 u u v v
Bellman-Ford algorithm: Fin
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 17
Prof. Erik Demaine
Paths in graphs
Consider a digraph G = (V, E) with edge-weight function w : E R. The weight of path p = v1 v2 L vk is defined to be
w( p ) = w(vi , vi +1 ) .
i =1
k -1
Example
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 16
Prof. Charles E. Leiserson
Graphs (review)
Definition. A directed graph (digraph) G = (V, E) is an ordered pair consisting of a set V of vertices (singular: vertex), a set E V V of edges. In an
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 15
Prof. Charles E. Leiserson
Dynamic programming
Design technique, like divide-and-conquer. Example: Longest Common Subsequence (LCS) Given two sequences x[1 . . m] and y[1 . . n], find a longest
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 14
Prof. Charles E. Leiserson
How large should a hash table be?
Goal: Make the table as small as possible, but large enough so that it won't overflow (or otherwise become inefficient). Problem: Wha
Introduction to Algorithms
6.046J/18.401J/SMA5503
Lecture 13
Prof. Erik Demaine
Fixed-universe successor problem
Goal: Maintain a dynamic subset S of size n of the universe U = cfw_0, 1, ., u 1 of size u subject to these operations: INSERT(x U \ S): Add x
M IS at Infosys
Presented By - G roup 8
Business Softw are and Enterprise
Products by Infosys
MIS drivers in Organization
Beliefs of Infosys and need for MIS :
Easily approachable organization
Complete transparency to customer
Providing business advan