SlideShare a Scribd company logo
1 of 27
CS 6212 – Design and Analysis
of Algorithms
INTRODUCTION AND
ASYMPTOTIC NOTATION
 Instructor
Prof. Amrinder Arora
amrinder@gwu.edu
Please copy TA on emails
Please feel free to call as well

 Available for study sessions
Science and Engineering Hall
GWU
Algorithms Introduction and Asymptotic Notation 2
LOGISTICS
Algorithms
Analysis
Asymptotic
NP-
Completeness
Design
D&C
DP
Greedy
Graph
B&B
Applications
Algorithms Introduction and Asymptotic Notation 3
COURSE OUTLINE
Design and Analysis of Algorithms
 Designing – Algorithmic Techniques
 Analyzing – how much time an algorithm takes
 Proving inherent complexity of problems
4
PURPOSE OF THIS CLASS
Algorithms Introduction and Asymptotic Notation
 A precise statement to solve a problem on a computer
 A sequence of definite instructions to do a certain job
5
“ALGORITHM” – DEFINITIONS
Algorithms Introduction and Asymptotic Notation
Pseudo-code consisting of:
 Variables
 Assignments
 Arrays
 Reading/Writing data
 Loops
 Switch/Case
 Function/Procedure
 Begin/End
Algorithms Introduction and Asymptotic Notation 6
REPRESENTING AN ALGORITHM
Given: An array A of n numbers
Purpose: To sort the array
Algorithm:
for j = 1 to n-1
key = A[j]
// A[j] is added in the sorted sequence A[1.. j-1]
i = j - 1
while i >= 0 and A [i] > key
A[ i + 1] = A[i]
i = i - 1
A [i +1] = key
7
EXAMPLE 1: INSERTION SORT
Algorithms Introduction and Asymptotic Notation
 Best case running time
 Worst case running time
 Average case running time
8
EXAMPLE 2: EUCLID’S ALGORITHM (CONT.)
gcd(n,m) {
r = n%m
if r == 0 return m
// else
return gcd(m, r)
}
Algorithms Introduction and Asymptotic Notation
BinarySearch(A[0..N-1], value, low, high)
{
if (high < low)
return -1 // not found
mid = (low + high) / 2
if (A[mid] > value)
return BinarySearch(A, value, low, mid-1)
else if (A[mid] < value)
return BinarySearch(A, value, mid+1, high)
else return mid // found
}
9
EXAMPLE 3: BINARY SEARCH
Algorithms Introduction and Asymptotic Notation
 How long will the algorithm take?
 How much memory will it require?
For Example:
Function sum (array a) {
sum = 0;
for (int j : a) {
sum = sum + j
}
return sum;
}
10
ANALYZING AN ALGORITHM
Algorithms Introduction and Asymptotic Notation
 Why to do it?
 A priori estimation of performance
 To compare algorithms on a level playing field
 How to do it? (What is the model?)
 Random access memory model
 Math operations take constant time
 Read/write operations take constant time
 What do we compute?
 Time complexity: # of operations as a function of input size
 Space complexity: # of bits used
11
ANALYZING AN ALGORITHM
Algorithms Introduction and Asymptotic Notation
How to Analyze a Given Algorithm (Program)
Some tips:
 When analyzing an if then else condition, consider the arm
that takes the longest time
 When considering a loop, take the sum
 When considering a nested loop, …
Algorithms Introduction and Asymptotic Notation 12
ANALYZING ALGORITHMS
j = 1
while (j < n) {
k = 2
while (k < n) {
Sum += a[j]*b[k]
k = k * k
}
j++
}
(n log log n)
For (int j = 1 to n) {
For (int k = j to n) {
x = k
While (x < n) {
Sum +=
a[j]*b[k]*c[x]
If (x % 3 == 0) {
x = n + 1
}
x = x + 1
}
}
}
For (int j = 1 to n) {
k = j
while (k < n) {
Sum += a[k]*b[k]
k += log n
}
}
Algorithms Introduction and Asymptotic Notation 13
WHAT IS THE TIME COMPLEXITY OF THIS
PROGRAM?
Possible Quiz Questions
 Sets, functions
 Logs and Exponents
 Recurrence Relations
 Sums of series
 Arithmetic Progression: 1 + 2 + 3 + … + n
 Geometric Progress: 1 + 3 + 9 + … 3k
 AGP: 1 + 2.3 + 3.9 + … (k+1) 3k
 Others: 12 + 22 + 32 + … + n2, Harmonic Series
14
REQUIRED MATH CONSTRUCTS
Algorithms Introduction and Asymptotic Notation
Simulation/Runoff
(on worst
case/average case)
•Provides incomplete
picture
•Works for complex
functions
Analysis and
comparison of
Asymptotic notation
•Provides a complete
theoretical
understanding
•May not work for
very complex
algorithms
15
COMPARING ALGORITHMS
Algorithms Introduction and Asymptotic Notation
 Big O notation
 f(n) = O(g(n)) if there exist constants n0 and c such that f(n) ≤ c g(n)
for all n ≥ n0.
For example, consider f(n) = n, and g(n) = n2. Then, f(n) = O(g(n))
If f(n) = a0 n0 + a1 n1 + … + am nm,
then f(n) = O (nm)
 Big Omega notation
 f(n) = Ω(g(n)) if there exist constants n0 and c such that f(n) ≥ c g(n)
for all n ≥ n0.
16
ASYMPTOTIC NOTATION
Algorithms Introduction and Asymptotic Notation
 Small o notation
 f(n) = o(g(n)) if for any constant c > 0, there exists n0 such that 0 ≤
f(n) < c g(n) for all n ≥ n0.
For example, n = o(n2)
 Small omega () notation
 f(n) = (g(n)) if for any constant c > 0, there exists n0 such that f(n) ≥
c g(n) ≥ 0, for all n ≥ n0
For example, n3 = (n2)
17
ASYMPTOTIC NOTATIONS (CONT.)
Algorithms Introduction and Asymptotic Notation
 f(n) = O(g(n)) if and only if g(n) = Ω(f(n))
 If f(n) = O(g(n)) and g(n) = O(f(n)), then f(n) = (g(n))
 f(n) = o(g(n)) if and only if g(n) = (f(n))
 f(n) = o(g(n)) implies limnf(n)/g(n) = 0
18
ASYMPTOTIC NOTATIONS (CONT.)
Algorithms Introduction and Asymptotic Notation
 In some cases, we need to use the L’Hopital’s rule to prove
the small oh notation. L’Hopital’s rule states that assuming
certain conditions hold,
 For example, suppose we want to prove the following:
(log n)3 + 3 (log n)2 = o(n)
 We can find the limit of these functions as follows:
limn(log n)3 + 3 (log n)2 / n
= limn6 (log n)2 + 12 log n / n1/2 // Using L’Hopital’s rule
= limn24 log n + 24/ n1/2 // Using L’Hopital’s rule
= limn48/ n1/2 // Using L’Hopital’s rule
= 0
Algorithms Introduction and Asymptotic Notation 19
PROVING SMALL OH USING L’HOPITAL’S
RULE
O o   Ω
≤ < = > ≥
20
ASYMPTOTIC NOTATIONS (CONT.)
Analogy with real numbers
Algorithms Introduction and Asymptotic Notation
Which properties apply to which (of
5) asymptotic notations?
 Transitivity
 Reflexivity
 Symmetry
 Transpose Symmetry
 Trichotomy
21
ASYMPTOTIC NOTATIONS (CONT.)
Algorithms Introduction and Asymptotic Notation
Which properties apply to which (of
5) asymptotic notations?
 Transitivity: O, o, , , Ω
 Reflexivity: O, , Ω
 Symmetry: 
 Transpose Symmetry: (O with Ω, o with )
 Trichotomy: Does not hold. For real numbers x
and y, we can always say that either x < y or x =
y or x > y. For functions, we may not be able to
say that. For example if f(n) = sin(n) and
g(n)=cos(n)
22
ASYMPTOTIC NOTATIONS (CONT.)
Algorithms Introduction and Asymptotic Notation
LOGISTICS
 Rigor required by this class
 Saturday study sessions (Optional)
 Study sessions on other days – You need to coordinate
 Grading – Review course information sheet in Blackboard
23Algorithms Introduction and Asymptotic Notation
SOME LESSONS FROM PREVIOUS CLASSES
 Almost no correlation between grades and background
 Correlation between grades and number of classes attended
 Correlation between grades and time spent on course
 Strong correlation between grades and homeworks/projects
24Algorithms Introduction and Asymptotic Notation
80% OF
SUCCESS IS
SHOWING UP.
Algorithms Introduction and Asymptotic Notation 25
 Review Project P1
 Review HW1
 Review Course Outline
Algorithms Introduction and Asymptotic Notation 26
READING ASSIGNMENTS
 http://en.wikipedia.org/wiki/Arithmetic_progression
 http://en.wikipedia.org/wiki/Geometric_series
 https://www.boundless.com/algebra/textbooks/boundless-
algebra-textbook/sequences-series-and-combinatorics-
8/sequences-and-series-53/introduction-to-sequences-224-
5904/
 http://en.wikipedia.org/wiki/L%27H%C3%B4pital%27s_rule
 https://www.youtube.com/watch?v=PdSzruR5OeE
Algorithms Introduction and Asymptotic Notation 27
HELPFUL LINKS

More Related Content

What's hot

Time and space complexity
Time and space complexityTime and space complexity
Time and space complexityAnkit Katiyar
 
Lecture 4 asymptotic notations
Lecture 4   asymptotic notationsLecture 4   asymptotic notations
Lecture 4 asymptotic notationsjayavignesh86
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxSyed Zaid Irshad
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest pathArafat Hossan
 
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IMohamed Loey
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAmrinder Arora
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencySaranya Natarajan
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy methodhodcsencet
 
finding Min and max element from given array using divide & conquer
finding Min and max element from given array using  divide & conquer finding Min and max element from given array using  divide & conquer
finding Min and max element from given array using divide & conquer Swati Kulkarni Jaipurkar
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardAnimesh Chaturvedi
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IMohamed Loey
 

What's hot (20)

Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Lecture 4 asymptotic notations
Lecture 4   asymptotic notationsLecture 4   asymptotic notations
Lecture 4 asymptotic notations
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest path
 
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms I
 
NP completeness
NP completenessNP completeness
NP completeness
 
Approximation Algorithms
Approximation AlgorithmsApproximation Algorithms
Approximation Algorithms
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
 
Time complexity
Time complexityTime complexity
Time complexity
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm Efficiency
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
finding Min and max element from given array using divide & conquer
finding Min and max element from given array using  divide & conquer finding Min and max element from given array using  divide & conquer
finding Min and max element from given array using divide & conquer
 
P, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-HardP, NP, NP-Complete, and NP-Hard
P, NP, NP-Complete, and NP-Hard
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
 

Similar to Introduction to Algorithms and Asymptotic Notation

how to calclute time complexity of algortihm
how to calclute time complexity of algortihmhow to calclute time complexity of algortihm
how to calclute time complexity of algortihmSajid Marwat
 
DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..KarthikeyaLanka1
 
Lec03 04-time complexity
Lec03 04-time complexityLec03 04-time complexity
Lec03 04-time complexityAbbas Ali
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.Tariq Khan
 
DAA-Unit1.pptx
DAA-Unit1.pptxDAA-Unit1.pptx
DAA-Unit1.pptxNishaS88
 
Brief introduction to Algorithm analysis
Brief introduction to Algorithm analysis Brief introduction to Algorithm analysis
Brief introduction to Algorithm analysis Anantha Ramu
 
Data Structures and Algorithms - Lec 02.pdf
Data Structures and Algorithms - Lec 02.pdfData Structures and Algorithms - Lec 02.pdf
Data Structures and Algorithms - Lec 02.pdfRameshaFernando2
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptISHANAMRITSRIVASTAVA
 
Daa unit 6_efficiency of algorithms
Daa unit 6_efficiency of algorithmsDaa unit 6_efficiency of algorithms
Daa unit 6_efficiency of algorithmssnehajiyani
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptxKokilaK25
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptxKarthikVijay59
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and ComplexityRajandeep Gill
 
Data Structure: Algorithm and analysis
Data Structure: Algorithm and analysisData Structure: Algorithm and analysis
Data Structure: Algorithm and analysisDr. Rajdeep Chatterjee
 

Similar to Introduction to Algorithms and Asymptotic Notation (20)

Time complexity.ppt
Time complexity.pptTime complexity.ppt
Time complexity.ppt
 
how to calclute time complexity of algortihm
how to calclute time complexity of algortihmhow to calclute time complexity of algortihm
how to calclute time complexity of algortihm
 
DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..DS Unit-1.pptx very easy to understand..
DS Unit-1.pptx very easy to understand..
 
Lec03 04-time complexity
Lec03 04-time complexityLec03 04-time complexity
Lec03 04-time complexity
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.
 
Unit 1
Unit 1Unit 1
Unit 1
 
Lec1
Lec1Lec1
Lec1
 
DAA-Unit1.pptx
DAA-Unit1.pptxDAA-Unit1.pptx
DAA-Unit1.pptx
 
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpall...
Algorithm Class at KPHB  (C, C++ Course Training Institute in KPHB, Kukatpall...Algorithm Class at KPHB  (C, C++ Course Training Institute in KPHB, Kukatpall...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpall...
 
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
 
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
 
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
Algorithm Class at KPHB (C, C++ Course Training Institute in KPHB, Kukatpally...
 
Brief introduction to Algorithm analysis
Brief introduction to Algorithm analysis Brief introduction to Algorithm analysis
Brief introduction to Algorithm analysis
 
Data Structures and Algorithms - Lec 02.pdf
Data Structures and Algorithms - Lec 02.pdfData Structures and Algorithms - Lec 02.pdf
Data Structures and Algorithms - Lec 02.pdf
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.ppt
 
Daa unit 6_efficiency of algorithms
Daa unit 6_efficiency of algorithmsDaa unit 6_efficiency of algorithms
Daa unit 6_efficiency of algorithms
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptx
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptx
 
Asymptotic Notation and Complexity
Asymptotic Notation and ComplexityAsymptotic Notation and Complexity
Asymptotic Notation and Complexity
 
Data Structure: Algorithm and analysis
Data Structure: Algorithm and analysisData Structure: Algorithm and analysis
Data Structure: Algorithm and analysis
 

More from Amrinder Arora

Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...Amrinder Arora
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchAmrinder Arora
 
Graph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search TraversalGraph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search TraversalAmrinder Arora
 
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Amrinder Arora
 
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet MahanaArima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet MahanaAmrinder Arora
 
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...Amrinder Arora
 
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...Amrinder Arora
 
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)Amrinder Arora
 
Online algorithms in Machine Learning
Online algorithms in Machine LearningOnline algorithms in Machine Learning
Online algorithms in Machine LearningAmrinder Arora
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisAmrinder Arora
 
Dynamic Programming - Part II
Dynamic Programming - Part IIDynamic Programming - Part II
Dynamic Programming - Part IIAmrinder Arora
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1Amrinder Arora
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsAmrinder Arora
 
Set Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom FiltersSet Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom FiltersAmrinder Arora
 
Binomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci HeapsBinomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci HeapsAmrinder Arora
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresAmrinder Arora
 
Tries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsTries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsAmrinder Arora
 

More from Amrinder Arora (20)

Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and ...
 
NP-Completeness - II
NP-Completeness - IINP-Completeness - II
NP-Completeness - II
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First Search
 
Graph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search TraversalGraph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search Traversal
 
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
 
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet MahanaArima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
 
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
 
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
 
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
 
Online algorithms in Machine Learning
Online algorithms in Machine LearningOnline algorithms in Machine Learning
Online algorithms in Machine Learning
 
Algorithmic Puzzles
Algorithmic PuzzlesAlgorithmic Puzzles
Algorithmic Puzzles
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
 
Dynamic Programming - Part II
Dynamic Programming - Part IIDynamic Programming - Part II
Dynamic Programming - Part II
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
 
Set Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom FiltersSet Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom Filters
 
Binomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci HeapsBinomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci Heaps
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data Structures
 
Tries - Tree Based Structures for Strings
Tries - Tree Based Structures for StringsTries - Tree Based Structures for Strings
Tries - Tree Based Structures for Strings
 

Recently uploaded

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 

Recently uploaded (20)

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 

Introduction to Algorithms and Asymptotic Notation

  • 1. CS 6212 – Design and Analysis of Algorithms INTRODUCTION AND ASYMPTOTIC NOTATION
  • 2.  Instructor Prof. Amrinder Arora amrinder@gwu.edu Please copy TA on emails Please feel free to call as well   Available for study sessions Science and Engineering Hall GWU Algorithms Introduction and Asymptotic Notation 2 LOGISTICS
  • 4. Design and Analysis of Algorithms  Designing – Algorithmic Techniques  Analyzing – how much time an algorithm takes  Proving inherent complexity of problems 4 PURPOSE OF THIS CLASS Algorithms Introduction and Asymptotic Notation
  • 5.  A precise statement to solve a problem on a computer  A sequence of definite instructions to do a certain job 5 “ALGORITHM” – DEFINITIONS Algorithms Introduction and Asymptotic Notation
  • 6. Pseudo-code consisting of:  Variables  Assignments  Arrays  Reading/Writing data  Loops  Switch/Case  Function/Procedure  Begin/End Algorithms Introduction and Asymptotic Notation 6 REPRESENTING AN ALGORITHM
  • 7. Given: An array A of n numbers Purpose: To sort the array Algorithm: for j = 1 to n-1 key = A[j] // A[j] is added in the sorted sequence A[1.. j-1] i = j - 1 while i >= 0 and A [i] > key A[ i + 1] = A[i] i = i - 1 A [i +1] = key 7 EXAMPLE 1: INSERTION SORT Algorithms Introduction and Asymptotic Notation
  • 8.  Best case running time  Worst case running time  Average case running time 8 EXAMPLE 2: EUCLID’S ALGORITHM (CONT.) gcd(n,m) { r = n%m if r == 0 return m // else return gcd(m, r) } Algorithms Introduction and Asymptotic Notation
  • 9. BinarySearch(A[0..N-1], value, low, high) { if (high < low) return -1 // not found mid = (low + high) / 2 if (A[mid] > value) return BinarySearch(A, value, low, mid-1) else if (A[mid] < value) return BinarySearch(A, value, mid+1, high) else return mid // found } 9 EXAMPLE 3: BINARY SEARCH Algorithms Introduction and Asymptotic Notation
  • 10.  How long will the algorithm take?  How much memory will it require? For Example: Function sum (array a) { sum = 0; for (int j : a) { sum = sum + j } return sum; } 10 ANALYZING AN ALGORITHM Algorithms Introduction and Asymptotic Notation
  • 11.  Why to do it?  A priori estimation of performance  To compare algorithms on a level playing field  How to do it? (What is the model?)  Random access memory model  Math operations take constant time  Read/write operations take constant time  What do we compute?  Time complexity: # of operations as a function of input size  Space complexity: # of bits used 11 ANALYZING AN ALGORITHM Algorithms Introduction and Asymptotic Notation
  • 12. How to Analyze a Given Algorithm (Program) Some tips:  When analyzing an if then else condition, consider the arm that takes the longest time  When considering a loop, take the sum  When considering a nested loop, … Algorithms Introduction and Asymptotic Notation 12 ANALYZING ALGORITHMS
  • 13. j = 1 while (j < n) { k = 2 while (k < n) { Sum += a[j]*b[k] k = k * k } j++ } (n log log n) For (int j = 1 to n) { For (int k = j to n) { x = k While (x < n) { Sum += a[j]*b[k]*c[x] If (x % 3 == 0) { x = n + 1 } x = x + 1 } } } For (int j = 1 to n) { k = j while (k < n) { Sum += a[k]*b[k] k += log n } } Algorithms Introduction and Asymptotic Notation 13 WHAT IS THE TIME COMPLEXITY OF THIS PROGRAM? Possible Quiz Questions
  • 14.  Sets, functions  Logs and Exponents  Recurrence Relations  Sums of series  Arithmetic Progression: 1 + 2 + 3 + … + n  Geometric Progress: 1 + 3 + 9 + … 3k  AGP: 1 + 2.3 + 3.9 + … (k+1) 3k  Others: 12 + 22 + 32 + … + n2, Harmonic Series 14 REQUIRED MATH CONSTRUCTS Algorithms Introduction and Asymptotic Notation
  • 15. Simulation/Runoff (on worst case/average case) •Provides incomplete picture •Works for complex functions Analysis and comparison of Asymptotic notation •Provides a complete theoretical understanding •May not work for very complex algorithms 15 COMPARING ALGORITHMS Algorithms Introduction and Asymptotic Notation
  • 16.  Big O notation  f(n) = O(g(n)) if there exist constants n0 and c such that f(n) ≤ c g(n) for all n ≥ n0. For example, consider f(n) = n, and g(n) = n2. Then, f(n) = O(g(n)) If f(n) = a0 n0 + a1 n1 + … + am nm, then f(n) = O (nm)  Big Omega notation  f(n) = Ω(g(n)) if there exist constants n0 and c such that f(n) ≥ c g(n) for all n ≥ n0. 16 ASYMPTOTIC NOTATION Algorithms Introduction and Asymptotic Notation
  • 17.  Small o notation  f(n) = o(g(n)) if for any constant c > 0, there exists n0 such that 0 ≤ f(n) < c g(n) for all n ≥ n0. For example, n = o(n2)  Small omega () notation  f(n) = (g(n)) if for any constant c > 0, there exists n0 such that f(n) ≥ c g(n) ≥ 0, for all n ≥ n0 For example, n3 = (n2) 17 ASYMPTOTIC NOTATIONS (CONT.) Algorithms Introduction and Asymptotic Notation
  • 18.  f(n) = O(g(n)) if and only if g(n) = Ω(f(n))  If f(n) = O(g(n)) and g(n) = O(f(n)), then f(n) = (g(n))  f(n) = o(g(n)) if and only if g(n) = (f(n))  f(n) = o(g(n)) implies limnf(n)/g(n) = 0 18 ASYMPTOTIC NOTATIONS (CONT.) Algorithms Introduction and Asymptotic Notation
  • 19.  In some cases, we need to use the L’Hopital’s rule to prove the small oh notation. L’Hopital’s rule states that assuming certain conditions hold,  For example, suppose we want to prove the following: (log n)3 + 3 (log n)2 = o(n)  We can find the limit of these functions as follows: limn(log n)3 + 3 (log n)2 / n = limn6 (log n)2 + 12 log n / n1/2 // Using L’Hopital’s rule = limn24 log n + 24/ n1/2 // Using L’Hopital’s rule = limn48/ n1/2 // Using L’Hopital’s rule = 0 Algorithms Introduction and Asymptotic Notation 19 PROVING SMALL OH USING L’HOPITAL’S RULE
  • 20. O o   Ω ≤ < = > ≥ 20 ASYMPTOTIC NOTATIONS (CONT.) Analogy with real numbers Algorithms Introduction and Asymptotic Notation
  • 21. Which properties apply to which (of 5) asymptotic notations?  Transitivity  Reflexivity  Symmetry  Transpose Symmetry  Trichotomy 21 ASYMPTOTIC NOTATIONS (CONT.) Algorithms Introduction and Asymptotic Notation
  • 22. Which properties apply to which (of 5) asymptotic notations?  Transitivity: O, o, , , Ω  Reflexivity: O, , Ω  Symmetry:   Transpose Symmetry: (O with Ω, o with )  Trichotomy: Does not hold. For real numbers x and y, we can always say that either x < y or x = y or x > y. For functions, we may not be able to say that. For example if f(n) = sin(n) and g(n)=cos(n) 22 ASYMPTOTIC NOTATIONS (CONT.) Algorithms Introduction and Asymptotic Notation
  • 23. LOGISTICS  Rigor required by this class  Saturday study sessions (Optional)  Study sessions on other days – You need to coordinate  Grading – Review course information sheet in Blackboard 23Algorithms Introduction and Asymptotic Notation
  • 24. SOME LESSONS FROM PREVIOUS CLASSES  Almost no correlation between grades and background  Correlation between grades and number of classes attended  Correlation between grades and time spent on course  Strong correlation between grades and homeworks/projects 24Algorithms Introduction and Asymptotic Notation
  • 25. 80% OF SUCCESS IS SHOWING UP. Algorithms Introduction and Asymptotic Notation 25
  • 26.  Review Project P1  Review HW1  Review Course Outline Algorithms Introduction and Asymptotic Notation 26 READING ASSIGNMENTS
  • 27.  http://en.wikipedia.org/wiki/Arithmetic_progression  http://en.wikipedia.org/wiki/Geometric_series  https://www.boundless.com/algebra/textbooks/boundless- algebra-textbook/sequences-series-and-combinatorics- 8/sequences-and-series-53/introduction-to-sequences-224- 5904/  http://en.wikipedia.org/wiki/L%27H%C3%B4pital%27s_rule  https://www.youtube.com/watch?v=PdSzruR5OeE Algorithms Introduction and Asymptotic Notation 27 HELPFUL LINKS