SlideServe
Menu
Préférences
© SlideServe · v2026

Exploring Tree Recursion with Fibonacci Numbers and Microsoft Agents

leia avatar
23 diapositives · 390 Views · Aug 14, 2014

This article delves into the concept of tree recursion, particularly through the lens of computing Fibonacci numbers. We begin with the classic Fibonacci sequence defined recursively, illustrating the computation process for `fib(n)` with an example where `n=5`. The recursive method leads to multiple calls, showcasing the importance of understanding tree structure in recursion. Additionally, we explore integrating Microsoft Agents to make learning more interactive, enhancing understanding through voice commands and user interactions. Inquire about further resources to dive deeper into MS Agents and their applications.

Exploring Tree Recursion with Fibonacci Numbers and Microsoft Agents - slide 1
01 / 23Exploring Tree Recursion with Fibonacci Numbers and Microsoft Agents
1 / 17

Télécharger la présentation

Exploring Tree Recursion with Fibonacci Numbers and Microsoft Agents
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Tree Recursion Traditional Approach

  2. Tree Recursion • Consider the Fibonacci Number Sequence: Time: 0 1 2 3 4 5 6 7 80, 1, 1, 2, 3, 5, 8, 13, 21, ... /0when n = 0fib(n)= |1 when n = 1\fib(n - 1) + fib(n - 2)otherwise

  3. Tree Recursion(cont.) • As code this is: int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; }

  4. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; }

  5. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4)

  6. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4)

  7. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4) fib(3) fib(2)

  8. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4) fib(3) fib(2)

  9. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4) fib(3) fib(2) fib(2) fib(1)

  10. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4) fib(3) fib(2) fib(2) fib(1)

  11. What happens when computing fib(5)? 5 2 3 2 1 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0 1 0

  12. What is the Problem? • I am explaining everything! • Why not make this more interesting by using MS Agents • Agents are helpers like the paper clip in Word • But they are much more: • They talk to you • And can, in some cases, understand voice commands

  13. Tree Recursion MS Agent Approach

  14. Tree Recursion • Consider the Fibonacci Number Sequence: Time: 0 1 2 3 4 5 6 7 8 0, 1, 1, 2, 3, 5, 8, 13, 21, ... • This sequence is defined by the rule: /0when n = 0 fib(n)= |1 when n = 1 \fib(n - 1) + fib(n - 2)otherwise

  15. Tree Recursion(cont.) • As code this is: int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; }

  16. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; }

  17. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4)

  18. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4)

  19. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4) fib(3) fib(2)

  20. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4) fib(3) fib(2)

  21. What happens when computing fib(5)? fib(5) int fib ( int n ) { if ( n <= 0 ) return 0; else if ( n = 1 ) return 1; else return fib ( n - 1 ) + fib ( n - 2 ) ; } fib(3) fib(4) fib(3) fib(2) fib(2) fib(1)

  22. MASH: Microsoft Agent Scripting Helper MASH is an editor that allows you to construct the scripts that you can then embed in other applications MASH

  23. Where to Learn More • MS Agent Page:http://msdn.microsoft.com/workshop/imedia/agent/default.asp • Sunfires MS Agent Page:http://www.angelfire.com/il2/sunfire/index.html • Uniquities MS Agent Planet:http://www.uniquities.co.uk/whatsnew.htm • Presentation Narrator: http://msdn.microsoft.com/workshop/imedia/agent/sampleoffice.asp • Microsoft Agent Scripting Helper:http://www.bellcraft.com/mash/