0% found this document useful (0 votes)
10 views5 pages

Algorith Thinking

The document discusses algorithmic thinking, outlining the steps to create algorithms, the benefits of algorithmic thinking, and the importance of iteration and conditional statements. It includes examples of everyday situations where algorithms can be applied, such as crossing the road and playing games. Additionally, it provides guidance on designing algorithms for various tasks and emphasizes the relationship between computational thinking and algorithms.

Uploaded by

usman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Algorith Thinking

The document discusses algorithmic thinking, outlining the steps to create algorithms, the benefits of algorithmic thinking, and the importance of iteration and conditional statements. It includes examples of everyday situations where algorithms can be applied, such as crossing the road and playing games. Additionally, it provides guidance on designing algorithms for various tasks and emphasizes the relationship between computational thinking and algorithms.

Uploaded by

usman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Unit:04 Algorithm Thinking

1. Answer the following.

a. Write an algorithm for “safely crossing a road”?

The algorithm can be written as follows:

START GO TO pavement LOOK at left and right

IF road=clear THEN cross the road ELSE WAIT

b. List the benefits of algorithmic thinking?

1. Since algorithms define a set of rules, it makes it easier to solve problems.


2. It allows to define the problem and provide a logical way to approach it.
3. It allows to work with large amounts of data.
4. It provides a roadmap to solve the problem
5. With the help of algorithmic thinking, one can analyze patterns and look for a solution
thereby
6. enhancing analytical thinking skills.

c. Explain the importance of using iteration in algorithms?

Repetitive tasks are common in programming. The concept of iteration allows one to repeat a

certain section or instructions of code required number of times by writing only a few commands

without having to manually repeat the instructions. For example, if a message needs to be printed

200 times, it would be efficient to do so with the help of an iterative statement rather than typing it

Manually.

d. Give examples of everyday situations where ‘if else’ conditional statement can be used?

The examples where IF ELSE can be used are:

i. Crossing Road – cross the road if it is clear else wait.

ii. Making tea – put tea leaves if the milk boils else wait.

iii. Going out in rainy season – take umbrella if it’s raining else not

e. what is the relationship between computational thinking and algorithms?

Computational thinking is a method of problem-solving, emphasizing critical thinking and the


creation of technology. Algorithmic thinking, closely linked to computational thinking, involves
a systematic approach to problem-solving by determining the step-by-step process.
Computational thinking enables automation through algorithmic thinking, providing a clear
roadmap to achieve specific goals.

f. What are the steps of designing an algorithm?

The steps to design an algorithm are given below:

i. Identifying the goal to be achieved.

ii. Access or gather the data both current and past data.

iii. Find different ways to yield the required output.


Unit:04 Algorithm Thinking

iv. Use logical reasoning to draw a proper relationship between input and output.

v. Visualize the results

vi. Monitor the results.

g. What is a conditional statement?

Conditional statements refer to the statements that allow the algorithm to take one or more
path. It works by evaluating a condition and proceeds further if the condition is met else the
algorithm takes an alternative route or set of instructions.

h. Explain the difference between finite and infinite loops?

The finite loops repeat the specified steps or set of instructions a set or finite number of times.
While an infinite loop runs forever unless stopped by an external factor.

i. Give an example of how sequence is used in an algorithm?

The sequence statements represent the order of the steps in an algorithm. An example of
sequence

algorithm is given below:

START

ENTER first number

ENTER second number

ADD firstnumber+secondnumber=result

SHOW result

END

Extra.

Define logical reasoning?

The application of rules to problem solving is called logical reasoning.

Define logical operator?

1. Logical operator helps the programmer to take specific decision.


2. We can use AND, OR, NOT logical operator.
3. It is use as condition that filter specific data

What is conditional statement?

A conditional statement is like a rule that tells you what to do based on a certain situation. It's
like saying, "If this happens, then do that." It helps you make decisions depending on what is
going on around you.

Define pseudocode?

Pseudocode is a way of planning and describing a computer program using simple and easy-to-
understand instructions, kind of like writing out the steps in a story. It's not a real programming
language, but it helps programmers organize their thoughts before they start writing actual
code.
Unit:04 Algorithm Thinking

Define loops?

Define sequence, selection and repetition?

Sequence:

1. Sequence shows the order in which the steps are to be taken.


2. If the order is not followed the desired outcome will not be achieved.

Selection:

It is used to select specific data /steps.

Repetition:

The algorithm repeats a certain step till a certain condition is met.

If you enter a wrong password to log in to your email account.

Application based questions

1. Write the steps to play the ‘snakes and ladder’ game. Review the steps and use iteration, where
required?

The steps to play snake and ladder game are given below:

i. Put your counter at the initial point in the board to begin the game.

ii. Move your counter according to the number of spaces shown in the dice

iii. If the counter lands at the bottom of the ladder, move up the ladder

iv. If your counter lands on the head of the snake slide to the bottom of snake

v. If either of this doesn’t happen, proceed with the count in normal order

vi. The first player to reach the end or home; is the winner.

The algorithm for this will be as follows:

BEGIN

REPEAT

MOVE counter

IF counter=bottom Ladder

climb up

IF counter=snakehead

climb down

ELSE

count+1

Until counter = home

STOP
Unit:04 Algorithm Thinking

2. Correct the sequence of the algorithm of writing a letter?

The corrected sequence is given below:

i. Take a sheet of paper

ii. Write on the sheet of paper

iii. Fold the letter

iv. Insert in an envelope

v. Seal the envelope

vi. Write the address of friend on the envelope

vii. Post the letter

In The Lab

1. Write algorithms for the following.


a. Convert time from hour to minutes

Time conversion algorithm:

START

DEFINE h,m (this defines the placeholder for hour and seconds minutes)

READ h (takes user input for hours)

m=h*60

DISPLAY m

END

b. Convert volume in liters into milliliters

To convert liters to ml (ml=1/1000 liters)

START

DEFINE ml, l (indicate value placeholders for milliliters and liters respectively)

READ l (take user input for liters)

ml=l/1000 (convert into ml).

DISPLAY ml

END

c. Organizing your toys according to color /size?

The algorithm to sort toys in red and blue color

START

DEFINE red-Basket, blue-Basket


Unit:04 Algorithm Thinking

READ toys (toys given as input by the user)

IF toys=RED

PLACE in red-Basket

ELSE

PLACE in Blue-Basket

REPEAT step 3

Group project

1. Planning a trip: students can work in group to plan a trip, such as a comping trip or a day
trip, they can use computational thinking to design an algorithm that covers transportation
,accommodation, activities and budget?

To design an algorithm for planning a trip can include the following:

a. Analyzing the budget.

b. Keeping budget in mind, making a list of places that can be travelled within the specified budget.

c. Researching about the place, sites to visit, accommodation etc

d. Contacting tour guides to determine packages

e. Preparing for the trip.

2. Creating a robot: students can work in groups to design and build a simple robot that can
perform a specific task, such as avoiding obstacles or following a line. They can use computational
thinking to design an algorithm that controls the robot’s movements?

A simple algorithm to control the movement of robot is given below:

START

MOVE FORWARD

MOVE BACKWARD

MOVE RIGHT

MOVE LEFT

END

You might also like