Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lecture "Algorithms", exercise 2 #5

Open
essepuntato opened this issue Nov 14, 2018 · 15 comments
Open

Lecture "Algorithms", exercise 2 #5

essepuntato opened this issue Nov 14, 2018 · 15 comments
Labels
Exercise The exercises that are introduced in the lectures.

Comments

@essepuntato
Copy link
Contributor

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”.

@essepuntato essepuntato added the Exercise The exercises that are introduced in the lectures. label Nov 14, 2018
@delfimpandiani
Copy link

exercise 2 delfina

@dersuchendee
Copy link

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

diagramuu

@MattiaSpadoni
Copy link

msdiagram

@friendlynihilist
Copy link

friendlynihilist commented Nov 14, 2018

untitled diagram

@mangiafrangette
Copy link

untitled diagram 1

@Ioanna96
Copy link

same

@lisasiurina
Copy link

untitled diagram

@VittoriaMoccia
Copy link

ex2 diagram

@tceron
Copy link

tceron commented Nov 15, 2018

diagram

@Totaro1996
Copy link

untitled diagram

@beccadelbens
Copy link

algoritmo

@andreamust
Copy link

untitled diagram

@SeverinJB
Copy link

algorithms_exercise_2

@ilsamoano
Copy link

2 issue flowchart

@essepuntato
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Exercise The exercises that are introduced in the lectures.
Projects
None yet
Development

No branches or pull requests