SlideShare a Scribd company logo
Introduction
Agenda
• Introduction
• Characteristics of an algorithm
• Pseudocode conventions
• Recursive algorithms
• Performance analysis
• Performance Measurement
Algorithm
 An algorithm is a finite set of instructions that,if followed,
accomplishes a particular task.
 Characteristics of algorithms are as follows:
1. Input
2. Output
3. Definiteness
4. Finiteness
5. Effectiveness
Pseudocode Conventions
1. Comments //
2. Block of statements { and }
3. Identifiers
4. Assignment of values to variables
5. Boolean values
6. Multidimensional array
7. Looping statemets
8. Conditional statements
9. Input and output
10. Procedure
Recursive Algorithms
 A recursive function is a function that is defined in terms of itself.
 An algorithm is said to be recursive if the same algorithm is invoked in the
body.
 An algorithm that calls itself is direct recursive.
 Algorithm A is said to be indirect recursive if it calls another algorithm
which in turn calls A.
Example
 Write algorithm to print Fibonacci series for given number
 Write an algorithm to print factorial of given number
 Write an algorithm to print sum of array elements
Performance Analysis
 Aim of this course is to develop skills for making evaluative judgments
about algorithm.
 There are two criteria for judging algorithms that have a more direct
relationship to performance. These have to do with their computing
time and storage requirements.
 [Space/Time complexity] The space complexity of an algorithm is the
amount of memory it needs to run to completion. The time complexity
of an algorithm is the amount of computer time it needs to run to
completion
 Performance evaluation can be loosely divided into two major phases:
(1) a priori estimates and (2) a posteriori testing. We refer to these as
performance analysis and performance measurement respectively.
Space Complexity
 The space complexity of an algorithm is the amount of memory it needs to run to
completion.
 The space needed by each algorithms is seen to be the sum of the following
components:
1. A fixed part that is independent of the characteristics (e.g., number, size)of the
inputs and outputs. This part typically includes the instruction space(i.e., space for
the code), space for simple variables, space for constants, and soon.
2.A variable part that consists of the space needed by component variables whose size
is dependent on the particular problem instance being solved, the space needed by
referenced variables, the recursion stack space.
Space Complexity
Time Complexity
 The time complexity of an algorithm is the amount of computer time it needs to run
to completion.
 The time T(P) taken by a program P is the sum of the compile time and the run (or
execution)time.
Example
Asymptotic Notations
 Analysis of algorithm is the process of analyzing the problem-
solving capability of the algorithm in terms of the time and size
required (the size of memory for storage while implementation).
 However, the main concern of analysis of algorithms is the
required time or performance. Generally, we perform the
following types of analysis −
 Worst-case − The maximum number of steps taken on any
instance of size a.
 Best-case − The minimum number of steps taken on any instance
of size a.
 Average case − An average number of steps taken on any
instance of size a.
Asymptotic Analysis
 When analyzing the running time or space usage of
programs, we usually try to estimate the time or space as
function of the input size.
 For example, when analyzing the worst case running
time of a function that sorts a list of numbers, we will be
concerned with how long it takes as a function of the
length of the input list.
 For example, we say the standard insertion sort takes
time T(n) where T(n)= c*n2+k for some constants c and k.
 In contrast, merge sort takes time T ′(n) = c′*n*log2(n)
+ k′.
Comp 122
Asymptotic Complexity
 Running time of an algorithm as a function of input size n
for large n.
 Describes behavior of function in the limit.
 Written using Asymptotic Notation.
Comp 122
O-notation
Comp 122
g(n) is an asymptotic upper bound for f(n).
Examples
 3n+2=O(n)
3n+2 <= c* n
3n+2 <= 4n for all n>=2
 100n +6 =O(n)
100n + 6 <= 101n for all n>=6
 Show that 3n3=O(n4) for appropriate c and n0.
Comp 122
-notation Comp 122
g(n) is an asymptotically tight bound for f(n).
Example
 3n +2 = (n)
c1* n <= 3n +2 <= c2* n
 What constants for n0, c1, and c2 will work?
 Make c1 a little smaller than the leading coefficient, and c2 a little
bigger.
c1=3, c2=4, and n0=2
3*n<=3n+2<=4*n for all n>=2
 Prove that 10n2 -3n=(n2)
 Prove that n2/2-3n= (n2)
Comp 122
 -notation
Comp 122
g(n) is an asymptotic lower bound for f(n).
Example
 3n + 2 = (n)
3n + 2>= c* n
3n +2>= 3n for all n>=0
 n = (log n). Choose c and n0.
Comp 122
Relations Between , O, 
Comp 122
Little oh o:
Little Omega ω
Ordered functions by their growth rates
Comp 122
Comp 122
Recurrence
 Recurrences arise when an algorithm contains recursive calls to itself
 What is the actual running time of the algorithm?
 Need to solve the recurrence
 Find an explicit formula of the expression
 Bound the recurrence by an expression that involves n
Example Recurrences
 T(n) = T(n-1) + n Θ(n2)
Recursive algorithm that loops through the input to eliminate one item
 T(n) = T(n/2) + c Θ(logn)
Recursive algorithm that halves the input in one step
 T(n) = T(n/2) + n Θ(n)
Recursive algorithm that halves the input but must examine every item in
the input
 T(n) = 2T(n/2) + 1 Θ(n)
Recursive algorithm that splits the input into 2 halves and does a constant
amount of other work
Methods for Solving Recurrences
 Substitution method
 Recursion tree method
 Master method
The substitution method
1. Guess a solution
2. Use induction to prove that the solution works
Example
 T(n) = 2T(n/2) + 1
 We guess that the solution is T(n)= O(n)
 The substitution method requires us to prove that T(n)<= c*n for
an appropriate choice of the constant c>0
 We start by assuming that this bound holds for all positive m<n in
particular for m=n/2
 T(n/2)<= cn/2
 T(n) <= 2(cn/2) +1
<= cn + 1
<= cn
The recursion-tree method
Convert the recurrence into a tree:
 Each node represents the cost incurred at various levels of
recursion
 Sum up the costs of all levels
Example 1
32
W(n) = 2W(n/2) + n2
 Subproblem size at level i is: n/2i
 Subproblem size hits 1 when 1 = n/2i  i = lgn
 Cost of the problem at level i = (n/2i)2 No. of nodes at level i = 2i
 Total cost:
 W(n) = O(n2)
2
2
0
2
1
lg
0
2
lg
1
lg
0
2
2
)
(
2
1
1
1
)
(
2
1
2
1
)
1
(
2
2
)
( n
n
O
n
n
O
n
n
n
W
n
n
W
i
i
n
i
i
n
n
i
i





















 








33
Example 2
E.g.: T(n) = 3T(n/4) + cn2
• Subproblem size at level i is: n/4i
• Subproblem size hits 1 when 1 = n/4i  i = log4n
• Cost of a node at level i = c(n/4i)2
• Number of nodes at level i = 3i  last level has 3log
4
n = nlog
4
3 nodes
• Total cost:
 T(n) = O(n2)
( ) ( ) ( ) )
(
16
3
1
1
16
3
16
3
)
( 2
3
log
2
3
log
2
0
3
log
2
1
log
0
4
4
4
4
n
O
n
cn
n
cn
n
cn
n
T
i
i
i
n
i






















 





34
Master’s method
 “Cookbook” for solving recurrences of the form:
where, a ≥ 1, b > 1, and f(n) > 0
 f(n) is asymptotically positive for all sufficiently large n.
)
(
)
( n
f
b
n
aT
n
T 







35
Master’s method
 “Cookbook” for solving recurrences of the form:
where, a ≥ 1, b > 1, and f(n) > 0
Idea: compare f(n) with nlog
b
a
Case 1: if f(n) = O(nlog
b
a -) for some  > 0, then: T(n) = (nlog
b
a)
Case 2: if f(n) = (nlog
b
a), then: T(n) = (nlog
b
a logn)
Case 3: if f(n) = (nlog
b
a +) for some  > 0, and if
af(n/b) ≤ cf(n) for some c < 1 and all sufficiently large n, then:
T(n) = (f(n))
)
(
)
( n
f
b
n
aT
n
T 







regularity condition
36
Examples
T(n) = 2T(n/2) + n
a = 2, b = 2, log22 = 1
Compare nlog
2
2 with f(n) = n
 f(n) = (n)  Case 2
 T(n) = (nlogn)
37
Examples
T(n) = 2T(n/2) + n2
a = 2, b = 2, log22 = 1
Compare n with f(n) = n2
 f(n) = (n1+) Case 3  verify regularity cond.
a f(n/b) ≤ c f(n)
 2 n2/4 ≤ c n2  c = ½ is a solution (c<1)
 T(n) = (n2)

More Related Content

PDF
Quick sort algorithn
PDF
Daa notes 1
PDF
UNIT-V.pdf daa unit material 5 th unit ppt
PPT
Data Structures- Part5 recursion
PPTX
PPTX
Divide and conquer 1
PPTX
Forests in data structures and algorithms .pptx
PPTX
DAA-Floyd Warshall Algorithm.pptx
Quick sort algorithn
Daa notes 1
UNIT-V.pdf daa unit material 5 th unit ppt
Data Structures- Part5 recursion
Divide and conquer 1
Forests in data structures and algorithms .pptx
DAA-Floyd Warshall Algorithm.pptx

What's hot (20)

PPT
Greedy algorithm
PPTX
PPTX
Ensemble learning
PPTX
DMBS Indexes.pptx
PDF
Data Structures Chapter-4
PPT
Master method theorem
PPTX
Introduction to Clustering algorithm
PPTX
Eclat algorithm in association rule mining
PPTX
Strassen's matrix multiplication
PPT
Indexing and hashing
PDF
Recurrence relation solutions
PPT
Recursion tree method
PPTX
strassen matrix multiplication algorithm
PPTX
Regular expressions
PPTX
Concurrency Control in Distributed Database.
PPT
Binary search tree in data structures
PPTX
Data Mining: Mining ,associations, and correlations
PPT
gSpan algorithm
PPTX
2 phase locking protocol DBMS
PPTX
Greedy algorithm
Ensemble learning
DMBS Indexes.pptx
Data Structures Chapter-4
Master method theorem
Introduction to Clustering algorithm
Eclat algorithm in association rule mining
Strassen's matrix multiplication
Indexing and hashing
Recurrence relation solutions
Recursion tree method
strassen matrix multiplication algorithm
Regular expressions
Concurrency Control in Distributed Database.
Binary search tree in data structures
Data Mining: Mining ,associations, and correlations
gSpan algorithm
2 phase locking protocol DBMS
Ad

Similar to Analysis of Algorithms, recurrence relation, solving recurrences (20)

PPTX
Analysis of Algorithms (1).pptx, asymptotic
PPTX
Design and analysis of algorithms unit1.pptx
PDF
Anlysis and design of algorithms part 1
PDF
Unit-1 DAA_Notes.pdf
PPTX
DS Unit-1.pptx very easy to understand..
PPT
how to calclute time complexity of algortihm
PPT
Time complexity.ppt
PPT
Time complexity.pptr56435 erfgegr t 45t 35
PPTX
Unit i basic concepts of algorithms
PPT
Design and Analysis of Algorithm Fundamental
PPT
How to calculate complexity in Data Structure
PDF
Chapter One.pdf
PPT
PPT
Lec03 04-time complexity
PPTX
Data Structure Algorithm -Algorithm Complexity
PPTX
DAA-Unit1.pptx
PPTX
Intro to super. advance algorithm..pptx
PDF
2 chapter2 algorithm_analysispart1
PDF
Annotations.pdf
PPTX
Lec 5 asymptotic notations and recurrences
Analysis of Algorithms (1).pptx, asymptotic
Design and analysis of algorithms unit1.pptx
Anlysis and design of algorithms part 1
Unit-1 DAA_Notes.pdf
DS Unit-1.pptx very easy to understand..
how to calclute time complexity of algortihm
Time complexity.ppt
Time complexity.pptr56435 erfgegr t 45t 35
Unit i basic concepts of algorithms
Design and Analysis of Algorithm Fundamental
How to calculate complexity in Data Structure
Chapter One.pdf
Lec03 04-time complexity
Data Structure Algorithm -Algorithm Complexity
DAA-Unit1.pptx
Intro to super. advance algorithm..pptx
2 chapter2 algorithm_analysispart1
Annotations.pdf
Lec 5 asymptotic notations and recurrences
Ad

More from Minakshee Patil (17)

PPTX
Introduction, characteristics, Pseudocode.pptx
PPTX
0-1_knapsack_using_Dynamic Programming.pptx
PPTX
Introduction to Computational Complexity Theory pptx
PPTX
Different Searching and Sorting Methods.pptx
PPTX
0-1_knapsack_using_DP, types of knapsack
PPT
Linear Data Structures, array, stack, queue
PPTX
Unit 5-BACKTRACKING- n queens, sum of subset, graph coloring problems
PPT
stack, opeartions on stack, applications of stack
PPTX
Algorithm Design Techiques, divide and conquer
PPT
Lecture2 (9).ppt
PPTX
oracle.pptx
PPT
Lecture1.ppt
PPT
Unit 1.ppt
PPTX
Hierarchical clustering algorithm.pptx
PPT
Lecture2 (1).ppt
PPT
Lecture3 (3).ppt
PPT
Lecture4.ppt
Introduction, characteristics, Pseudocode.pptx
0-1_knapsack_using_Dynamic Programming.pptx
Introduction to Computational Complexity Theory pptx
Different Searching and Sorting Methods.pptx
0-1_knapsack_using_DP, types of knapsack
Linear Data Structures, array, stack, queue
Unit 5-BACKTRACKING- n queens, sum of subset, graph coloring problems
stack, opeartions on stack, applications of stack
Algorithm Design Techiques, divide and conquer
Lecture2 (9).ppt
oracle.pptx
Lecture1.ppt
Unit 1.ppt
Hierarchical clustering algorithm.pptx
Lecture2 (1).ppt
Lecture3 (3).ppt
Lecture4.ppt

Recently uploaded (20)

PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
composite construction of structures.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Digital Logic Computer Design lecture notes
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
composite construction of structures.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Digital Logic Computer Design lecture notes
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Model Code of Practice - Construction Work - 21102022 .pdf
Lecture Notes Electrical Wiring System Components
OOP with Java - Java Introduction (Basics)
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Structs to JSON How Go Powers REST APIs.pdf
Foundation to blockchain - A guide to Blockchain Tech

Analysis of Algorithms, recurrence relation, solving recurrences

  • 2. Agenda • Introduction • Characteristics of an algorithm • Pseudocode conventions • Recursive algorithms • Performance analysis • Performance Measurement
  • 3. Algorithm  An algorithm is a finite set of instructions that,if followed, accomplishes a particular task.  Characteristics of algorithms are as follows: 1. Input 2. Output 3. Definiteness 4. Finiteness 5. Effectiveness
  • 4. Pseudocode Conventions 1. Comments // 2. Block of statements { and } 3. Identifiers 4. Assignment of values to variables 5. Boolean values 6. Multidimensional array 7. Looping statemets 8. Conditional statements 9. Input and output 10. Procedure
  • 5. Recursive Algorithms  A recursive function is a function that is defined in terms of itself.  An algorithm is said to be recursive if the same algorithm is invoked in the body.  An algorithm that calls itself is direct recursive.  Algorithm A is said to be indirect recursive if it calls another algorithm which in turn calls A.
  • 6. Example  Write algorithm to print Fibonacci series for given number  Write an algorithm to print factorial of given number  Write an algorithm to print sum of array elements
  • 7. Performance Analysis  Aim of this course is to develop skills for making evaluative judgments about algorithm.  There are two criteria for judging algorithms that have a more direct relationship to performance. These have to do with their computing time and storage requirements.  [Space/Time complexity] The space complexity of an algorithm is the amount of memory it needs to run to completion. The time complexity of an algorithm is the amount of computer time it needs to run to completion  Performance evaluation can be loosely divided into two major phases: (1) a priori estimates and (2) a posteriori testing. We refer to these as performance analysis and performance measurement respectively.
  • 8. Space Complexity  The space complexity of an algorithm is the amount of memory it needs to run to completion.  The space needed by each algorithms is seen to be the sum of the following components: 1. A fixed part that is independent of the characteristics (e.g., number, size)of the inputs and outputs. This part typically includes the instruction space(i.e., space for the code), space for simple variables, space for constants, and soon. 2.A variable part that consists of the space needed by component variables whose size is dependent on the particular problem instance being solved, the space needed by referenced variables, the recursion stack space.
  • 10. Time Complexity  The time complexity of an algorithm is the amount of computer time it needs to run to completion.  The time T(P) taken by a program P is the sum of the compile time and the run (or execution)time.
  • 12. Asymptotic Notations  Analysis of algorithm is the process of analyzing the problem- solving capability of the algorithm in terms of the time and size required (the size of memory for storage while implementation).  However, the main concern of analysis of algorithms is the required time or performance. Generally, we perform the following types of analysis −  Worst-case − The maximum number of steps taken on any instance of size a.  Best-case − The minimum number of steps taken on any instance of size a.  Average case − An average number of steps taken on any instance of size a.
  • 13. Asymptotic Analysis  When analyzing the running time or space usage of programs, we usually try to estimate the time or space as function of the input size.  For example, when analyzing the worst case running time of a function that sorts a list of numbers, we will be concerned with how long it takes as a function of the length of the input list.  For example, we say the standard insertion sort takes time T(n) where T(n)= c*n2+k for some constants c and k.  In contrast, merge sort takes time T ′(n) = c′*n*log2(n) + k′. Comp 122
  • 14. Asymptotic Complexity  Running time of an algorithm as a function of input size n for large n.  Describes behavior of function in the limit.  Written using Asymptotic Notation. Comp 122
  • 15. O-notation Comp 122 g(n) is an asymptotic upper bound for f(n).
  • 16. Examples  3n+2=O(n) 3n+2 <= c* n 3n+2 <= 4n for all n>=2  100n +6 =O(n) 100n + 6 <= 101n for all n>=6  Show that 3n3=O(n4) for appropriate c and n0. Comp 122
  • 17. -notation Comp 122 g(n) is an asymptotically tight bound for f(n).
  • 18. Example  3n +2 = (n) c1* n <= 3n +2 <= c2* n  What constants for n0, c1, and c2 will work?  Make c1 a little smaller than the leading coefficient, and c2 a little bigger. c1=3, c2=4, and n0=2 3*n<=3n+2<=4*n for all n>=2  Prove that 10n2 -3n=(n2)  Prove that n2/2-3n= (n2) Comp 122
  • 19.  -notation Comp 122 g(n) is an asymptotic lower bound for f(n).
  • 20. Example  3n + 2 = (n) 3n + 2>= c* n 3n +2>= 3n for all n>=0  n = (log n). Choose c and n0. Comp 122
  • 21. Relations Between , O,  Comp 122
  • 24. Ordered functions by their growth rates Comp 122
  • 26. Recurrence  Recurrences arise when an algorithm contains recursive calls to itself  What is the actual running time of the algorithm?  Need to solve the recurrence  Find an explicit formula of the expression  Bound the recurrence by an expression that involves n
  • 27. Example Recurrences  T(n) = T(n-1) + n Θ(n2) Recursive algorithm that loops through the input to eliminate one item  T(n) = T(n/2) + c Θ(logn) Recursive algorithm that halves the input in one step  T(n) = T(n/2) + n Θ(n) Recursive algorithm that halves the input but must examine every item in the input  T(n) = 2T(n/2) + 1 Θ(n) Recursive algorithm that splits the input into 2 halves and does a constant amount of other work
  • 28. Methods for Solving Recurrences  Substitution method  Recursion tree method  Master method
  • 29. The substitution method 1. Guess a solution 2. Use induction to prove that the solution works
  • 30. Example  T(n) = 2T(n/2) + 1  We guess that the solution is T(n)= O(n)  The substitution method requires us to prove that T(n)<= c*n for an appropriate choice of the constant c>0  We start by assuming that this bound holds for all positive m<n in particular for m=n/2  T(n/2)<= cn/2  T(n) <= 2(cn/2) +1 <= cn + 1 <= cn
  • 31. The recursion-tree method Convert the recurrence into a tree:  Each node represents the cost incurred at various levels of recursion  Sum up the costs of all levels
  • 32. Example 1 32 W(n) = 2W(n/2) + n2  Subproblem size at level i is: n/2i  Subproblem size hits 1 when 1 = n/2i  i = lgn  Cost of the problem at level i = (n/2i)2 No. of nodes at level i = 2i  Total cost:  W(n) = O(n2) 2 2 0 2 1 lg 0 2 lg 1 lg 0 2 2 ) ( 2 1 1 1 ) ( 2 1 2 1 ) 1 ( 2 2 ) ( n n O n n O n n n W n n W i i n i i n n i i                               
  • 33. 33 Example 2 E.g.: T(n) = 3T(n/4) + cn2 • Subproblem size at level i is: n/4i • Subproblem size hits 1 when 1 = n/4i  i = log4n • Cost of a node at level i = c(n/4i)2 • Number of nodes at level i = 3i  last level has 3log 4 n = nlog 4 3 nodes • Total cost:  T(n) = O(n2) ( ) ( ) ( ) ) ( 16 3 1 1 16 3 16 3 ) ( 2 3 log 2 3 log 2 0 3 log 2 1 log 0 4 4 4 4 n O n cn n cn n cn n T i i i n i                             
  • 34. 34 Master’s method  “Cookbook” for solving recurrences of the form: where, a ≥ 1, b > 1, and f(n) > 0  f(n) is asymptotically positive for all sufficiently large n. ) ( ) ( n f b n aT n T        
  • 35. 35 Master’s method  “Cookbook” for solving recurrences of the form: where, a ≥ 1, b > 1, and f(n) > 0 Idea: compare f(n) with nlog b a Case 1: if f(n) = O(nlog b a -) for some  > 0, then: T(n) = (nlog b a) Case 2: if f(n) = (nlog b a), then: T(n) = (nlog b a logn) Case 3: if f(n) = (nlog b a +) for some  > 0, and if af(n/b) ≤ cf(n) for some c < 1 and all sufficiently large n, then: T(n) = (f(n)) ) ( ) ( n f b n aT n T         regularity condition
  • 36. 36 Examples T(n) = 2T(n/2) + n a = 2, b = 2, log22 = 1 Compare nlog 2 2 with f(n) = n  f(n) = (n)  Case 2  T(n) = (nlogn)
  • 37. 37 Examples T(n) = 2T(n/2) + n2 a = 2, b = 2, log22 = 1 Compare n with f(n) = n2  f(n) = (n1+) Case 3  verify regularity cond. a f(n/b) ≤ c f(n)  2 n2/4 ≤ c n2  c = ½ is a solution (c<1)  T(n) = (n2)