Beauty in Recursion, Fractals Gur Saran Adhar Computer Science Department.

Slides:



Advertisements
Similar presentations
Lecture Computer Science I - Martin Hardwick Recursion rA recursive function must have at least two parts l A part that solves a simple case of the.
Advertisements

For(int i = 1; i
Tree Recursion Traditional Approach. Tree Recursion Consider the Fibonacci Number Sequence: Time: , 1, 1, 2, 3, 5, 8, 13, 21,... /
EC-111 Algorithms & Computing Lecture #11 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Great Theoretical Ideas in Computer Science.
Dynamic Programming From An
§3 Dynamic Programming Use a table instead of recursion 1. Fibonacci Numbers: F(N) = F(N – 1) + F(N – 2) int Fib( int N ) { if ( N
Dr. Sharon Persinger October 30,  Recursion is a type of repetition used in mathematics and computing to create objects and to define functions.
Lecture 2 Aug goals: Introduction to recursion examples of recursive programs.
Lecture 2 Aug 28 goals: Introduction to recursion examples of recursive programs.
CS 106 Introduction to Computer Science I 11 / 09 / 2007 Instructor: Michael Eckmann.
Self-Reference - Recursion Cmput Lecture 6 Department of Computing Science University of Alberta ©Duane Szafron 1999 Some code in this lecture is.
Recursive Algorithms Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Csci1300 Introduction to Programming Recursion Dan Feng.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 - Functions Outline 3.12Recursion 3.13Example Using Recursion: The Fibonacci Series 3.14Recursion.
Recursion. Idea: Some problems can be broken down into smaller versions of the same problem Example: n! 1*2*3*…*(n-1)*n n*factorial of (n-1)
Fundamental in Computer Science Recursive algorithms 1.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 5 – Recursive Funtions From Deitel’s “C” Book 5.13Recursion 5.14Example Using Recursion: The Fibonacci.
Recursion: Function and Programming Software Engineering at Azusa Pacific University  Evolutionary Approach  Examples and Algorithms  Programming in.
CS 46B: Introduction to Data Structures July 30 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak.
1 Chapter 18-1 Recursion Dale/Weems. 2 Chapter 18 Topics l Meaning of Recursion l Base Case and General Case in Recursive Function Definitions l Writing.
Recursion Fall 2008 Dr. David A. Gaitros
Recursion. Basic problem solving technique is to divide a problem into smaller subproblems These subproblems may also be divided into smaller subproblems.
Recursion.  A recursive function contains a call to itself Example: the factorial n!=n*(n-1)! for n>1 n!=1 for n=1 int factorial (int n) { if (n == 0)
Algorithmic Recursion. Recursion Alongside the algorithm, recursion is one of the most important and fundamental concepts in computer science as well.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Recursion COMP 102 # T1.
RecursionRecursion Recursion You should be able to identify the base case(s) and the general case in a recursive definition To be able to write a recursive.
Chapter 15 Recursion INTRODUCTION Recursion is a program-solving technique that expresses the solution of a problem in terms of the solutions of.
computer
Computer Science Department Data Structure & Algorithms Lecture 8 Recursion.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Functions (Recursion) Outline 5.13Recursion 5.14Example.
Reading – Chapter 10. Recursion The process of solving a problem by reducing it to smaller versions of itself Example: Sierpinski’s TriangleSierpinski’s.
Fractals. Most people don’t think of mathematics as beautiful but when you show them pictures of fractals…
Department of Computer Science 1 Last Class on Chapter 6 1. HW 1 and HW 2 2. Greatest Common Devisor 3. Sudoku App 4. Chapter 6 Summary 5. Chapter 6 Questions.
Fractal self similarity A fractal is a mathematical object that exhibits self similarity — it looks the same at any scale.
Recursion Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? Don’t let problems hang.
Department of Computer Science 1 Recursion & Backtracking 1.The game of NIM 2.Getting out of a maze 3.The 8 Queen’s Problem 4.Sudoku.
CSC 221: Recursion. Recursion: Definition Function that solves a problem by relying on itself to compute the correct solution for a smaller version of.
Lecture 2 Jan Goals: Introduction to recursion Examples of recursive programs Reading: Chapter 1 of the text.
PCDN Innsbruck, Austria Feb., 2003 Optimum Interval Routing in k-Caterpillars and Maximal Outer Planar Networks Gur Saran Adhar Department of Computer.
Discrete Structures and The Three-Fold Introduction to Computer Science Doug Baldwin Department of Computer Science SUNY Geneseo.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 8: Recursion Presentation slides for Java Software Solutions for AP* Computer Science 3rd.
Chapter 6 Questions Quick Quiz
Recursion A recursive definition is one which uses the word or concept being defined in the definition itself Example: “A computer is a machine.
 Introduction  Definition of a fractal  Special fractals: * The Mandelbrot set * The Koch snowflake * Sierpiński triangle  Fractals in nature  Conclusion.
1Computer Sciences. 2 GROWTH OF FUNCTIONS 3.2 STANDARD NOTATIONS AND COMMON FUNCTIONS.
1Computer Sciences Department. Objectives Recurrences.  Substitution Method,  Recursion-tree method,  Master method.
A Brief Introduction to Recursion. Recursion Recursive methods … –methods that call themselves! –They can only solve a base case –So, you divide a problem.
We want to add here all the Eleven schools that are functional. Next slide shows how it would look when we click on School of Studies.
Visual C++ Programming: Concepts and Projects Chapter 10A: Recursion (Concepts)
1 Recursion Recursive function: a function that calls itself (directly or indirectly). Recursion is often a good alternative to iteration (loops). Its.
1.5.3 Walkthrough #4 bouncing_ball.py wrapping_ball.py
CompSci Today’s topics Java Recursion Upcoming Graphics Reading Great Ideas, Chapter 4 (begin Chapter 5 for graphics)
CSC 143 P 1 CSC 143 Recursion [Chapter 5]. CSC 143 P 2 Recursion  A recursive definition is one which is defined in terms of itself  Example:  Compound.
Recursion ITFN The Stack. A data structure maintained by each program at runtime. Push Pop.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 10A Recursion (Concepts)
Iterative Mathematics
Introduction to Recursion - What is it? - When is it used? - Examples
CMSC201 Computer Science I for Majors Lecture 18 – Recursion
10.3 Details of Recursion.
Introduction to Computer Science - Alice
Adapted from slides by Marty Stepp, Stuart Reges & Allison Obourn.
זכויות סוציאליות.
The Mystery of the Fractal
Cs212: DataStructures Computer Science Department Lab 3 : Recursion.
Fractals The Hilbert Curve.
CS148 Introduction to Programming II
CMPT 120 Lecture 16 – Unit 3 – Graphics and Animation
CMPT 120 Lecture 18 – Unit 3 – Graphics and Animation
Recursion 1. The computer science equivalent of mathematical induction. 2. A way of defining something in terms of itself. 3. Ex. f(n) = 1,
Presentation transcript:

Beauty in Recursion, Fractals Gur Saran Adhar Computer Science Department

A simple example in Recursion H-tree

H-tree level 2

H-tree level 3

Recursion (key idea) Letter H is an H-tree An H-tree attached to each end of an H-tree is also an H-tree Define an object in terms of copies of itself

Recursion in Mathematics

Iteration vs. Recursion int Product(int n) //iteration { int i, result =1; for ( i = 1; i <= n; i++) result = result*i; return(result) } int Product(int n)//recursion { if ( n ==1) return (1); else return(n*Product(n-1)); }

Quad Tree Representation of a region

Snowflake (Koch Curve)

Fractal Dimension D = ln(n)/ ln(1/s) Higher dimension exhibits more jagged surfaces For snowflake D = ln(4)/ln(3) = 1.26

Fern

Describing a Branch B A[B]AA(B)

Language of Recursion Describing a tree Rules A AA B A[B]AA(B)

First Tree from grammar

Trees

Mountains

More mountains

Structure of Clouds (NASA) in marine stratocumuluson on July 7, First few frames showing the transition from GOES 1 km to Landsat 0.03 km resolution, and then zoom in by 7 successive factors of 2, to see that what's inside a GOES pixel can look rather similar to what's inside the full 500 km gridbox. This so-called "self-similarity" of clouds is characteristic of fractals.

Clouds

lightening

Leaf

Coastline

waterfall