/
Good Good

Good - PowerPoint Presentation

olivia-moreira
olivia-moreira . @olivia-moreira
Follow
374 views
Uploaded On 2016-03-09

Good - PPT Presentation

morning Recursive Algorithms Dr Jeyakesavan Veerasamy jeyvutdallasedu Example Gift box Example Gift box Example Gift box Value of gift box Equation Example Treasure hunt What is recursion ID: 248671

solution recursion understand amp recursion solution amp understand recursive box gift fibonacci factorial sort target instance puzzle diagramexample concepts

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Good" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Good

morning!Slide2
Slide3
Slide4

Recursive AlgorithmsDr. Jeyakesavan Veerasamyjeyv@utdallas.eduSlide5

Example: Gift box!Slide6

Example: Gift box!Slide7

Example: Gift box!Slide8

Value of gift box : Equation?Slide9

Example: Treasure hunt!Slide10

What is recursion?Popular in math definitionsInductive proofSlide11

Example: factorial(n)Slide12

Example: factorial(n)Non-recursive solutionSlide13

How does recursion work?Stack memoryHow much stack memory is needed?Slide14

How to understand recursion?Method invocations & returns diagramExample: factorial(5)Slide15

How to understand recursion?Method invocations & returns diagramExample: fibonacci(n)Slide16

How to understand recursion?Tree diagramExample: fibonacci(n)Slide17

fibonacci(n) : non-recursive solution?Slide18

How to analyze recursion?Recurrence relation & Time complexitySlide19

Example: Hanoi towerSlide20

Example: FractalsSlide21

Petrol cost minimization problemSlide22

Similar solution: Quick-sortSlide23

Quick-sort: non-recursive solution?Slide24

Similar solution: Merge-sortSlide25

Example: Knapsack problemItem weights: 40, 10, 46, 23, 22, 16, 27, 6Instance #1: Target : 50Instance #2: Target: 60Instance #3: Target: 70Slide26
Slide27

How to make recursion efficient?ParametersTail recursionSlide28

Example: N-Queens puzzleSlide29

Example: Knight’s tourSlide30

Example: Sudoku’s puzzleSlide31

Example: Maximizing total convivialitySlide32

ConclusionsRecursion is one of the difficult concepts to understand, perhaps it is not that intuitive.As per a few mathematicians & CS folks, it is one of the most beautiful concepts!While it is not used much in commercial applications, it certainly puts your logical thinking skills to work! It is easy to remove tail recursion, but all others are lot harder to remove. Slide33

Questions & Answers?