comp-think/2020-2021

Lecture "Algorithms", exercise 3

essepuntato opened this issue · 26 comments

The previous lecture notes, entitled “Introduction to Computational Thinking”, illustrate two different algorithms, expressed in natural language, for implementing the Fibonacci function. Create two distinct flowcharts to implement both of them.

20201016_154916
Referring to the first algorithm (sorry for my handwriting)

I think this is the first algorithm
Screen Shot 2020-10-16 at 4 08 31 PM

And I think this is the second but tbh my head hurts
Screen Shot 2020-10-16 at 4 10 38 PM

I forgot to specify the value in the third return value box, should be return value "sum" or something like that...

Fibonacci 2

I don't know if this was what I was supposed to come up with, but I tried to make something similar to a "do loop" with a check variable, in order to generalie the function.

Fibonacci without recursion
Diagram (1)
Fibonacci with recursion
Diagram (2)

This is the first algorithm
Flowchart1_es3_lez2

Flowchart Fibonacci Iterativo
Flowchart for the first algorithm

Flowchart Fibonacci ricorsivo (2)
Flowchart for the second algorithm

Second (recursive) algorithm:
Flowchart_Fibonacci_Recursive

First algorithm

Ex3_1

Second algorithm

Ex3_2

Fibonacci ex. 1
Untitled Diagram(1)

Fibonacci 2
Untitled Diagram(2)

image
The second flowchart

First algroroithm
Fibonacci 1

Fibonacci 1
immagine

Fibonacci 2
immagine