Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Name:Muhammad

Hafeez
Roll No: 2K20/CSE/05
Assignment: Algorithm
Week: 01
Q:1 Write an algorithm to call your friend?

Ans: Here are two possible Conditions

a) If we call our friend directly face to face then;


1. First I go near my friend as he hears my voice clearly.
2. Then I call him by his/her name
3. And finally our conversation will start.
b) Second condition if we call our friend on phone call then;
1. Dial our friend number in phone.
2. Then I connect it to network, if network connection is good then call
is on line, otherwise we are not able to call our friend.
3. If network connect my call then it go to my friend, now it depend on
friend either he receives the call or cancel the call.
4. If he receive the call then I able to talk to him.

Q:2 Give a real world example that requires sorting for its problems.

Ans:

a) First we analyze the problem in a proper way.


b) Find possible solution for that problem.
c) Apply one suitable solution to the problem.
d) And finally our problem is finished.

Q 3: write an algorithm for searching “Algorithm’s” textbook from


library.

Ans:

a) Go to the library.
b) Then go to the algorithm’s book section
c) Pickup the book which you want
d) Book is finded.

Q:4 How does one get to see the film ‘THREE IDIOTS’ In the cinema.
Ans:

a) Buy the ticket of cinema house


b) Go to the cinema house on the day of that film.
c) Get in cinema and sit on your seat.
d) As movie starts just watch the movie.

You might also like