comp-think / 2018-2019

The GitHub repository containing all the material related to the Computational Thinking and Programming course of the Digital Humanities and Digital Knowledge degree at the University of Bologna (a.a. 2018/2019).
Other
30 stars 8 forks source link

Lecture "Algorithms", exercise 2 #5

Open essepuntato opened 5 years ago

essepuntato commented 5 years ago

Write the flowchart of an algorithm that takes in input two objects and returns “yes” whether the two objects are the same, otherwise it returns “no”.

delfimpandiani commented 5 years ago

exercise 2 delfina

dersuchendee commented 5 years ago

diagram I also thought- not sure about that, though-: if the two objects are numbers:

diagramuu

MattiaSpadoni commented 5 years ago

msdiagram

friendlynihilist commented 5 years ago

untitled diagram

mangiafrangette commented 5 years ago

untitled diagram 1

Ioanna96 commented 5 years ago

same

lisasiurina commented 5 years ago

untitled diagram

VittoriaMoccia commented 5 years ago

ex2 diagram

tceron commented 5 years ago

diagram

Totaro1996 commented 5 years ago

untitled diagram

beccadelbens commented 5 years ago

algoritmo

andreamust commented 5 years ago

untitled diagram

SeverinJB commented 5 years ago

algorithms_exercise_2

ilsamoano commented 5 years ago

2 issue flowchart

essepuntato commented 5 years ago

Hi all,

Thanks for your answers. Please remember that, even if the flowcharts are an informal way to describe an algorithm, if the computational problem in input says that one should return "yes" or "no", then that is what it is expected. In particular, returning numbers, for instance, is not the right way of implementing the algorithm – even if it is pretty clear to me what the numbers actually stand for.

Another issue that I saw is that some of you have used explicitly names of different objects in body of the algorithm (e.g. marker vs. pen). This should be avoided in the definition of the algorithm, since it seems that the only possibility that such algorithm has is to take in input a marker and a pen, while it is supposed to work with any input object – e.g. what if I want to run it using two pens, or an apple and an orange?

Finally, if you initialise something (e.g. "initialise result = 0"), then one should use it somehow (e.g. by returning the result value). See the example in the lecture notes for clarification on this passage.