0% found this document useful (0 votes)
3 views

Algorithm 1

The document explains the concept of algorithms and decomposition, emphasizing the need for detailed instructions in programming. It provides a step-by-step guide for tasks such as making a sandwich and getting dressed, illustrating how to break down larger tasks into manageable steps. The final section includes an example algorithm for retrieving a t-shirt from a closet and putting it on.

Uploaded by

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

Algorithm 1

The document explains the concept of algorithms and decomposition, emphasizing the need for detailed instructions in programming. It provides a step-by-step guide for tasks such as making a sandwich and getting dressed, illustrating how to break down larger tasks into manageable steps. The final section includes an example algorithm for retrieving a t-shirt from a closet and putting it on.

Uploaded by

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

Algorithm

An algorithm is a step by step guide to do something

Decomposition

Taking something bigger and breaking it down into smaller pieces

We need to decompose instructions when programming because the computer needs very
detailed information or else it wont function

1. How do I open the bread bin?

rotate the cap in the bread bin to open it

How do I get the two slices out?

put your hand inside the bin and take 2 sheets or breads

2. How do I get the peanut butter out of the fridge?

open the fridge by pulling the handle

search for the peanut butter jar

take the peanut butter jar out

close the fridge

3. How do I put the peanut butter on the bread?

go and get a butter knife

open the peanut butter jar by rotating the cap

take the butter knife

put the knife a inside the peanut butter jar

take out some peanut butter as much as the size of your thumb

take a slice of a bread on one of your hands

with the other hand get the butter knife that contains the peanut butter

now spread the peanut butter across the bread

4. How do I close the bread into a sandwich?

align the slices of the bread so their edges are equally matched

close the both slices gently together after aligning it

B.Write an algorithm like the above for getting a t-shirt out of the closet and
putting it on.

Walk towards the closet and open the closet

search for the t shirt you are looking for


after selecting which t shirt take it out

close the closet

take off the shirt you are wearing

pick up the shirt you took out from the closet

put your head in the neck opening or the middle hole

and put your left arm in the left sleeve and the right arm in the right sleeve

and check if you are wearing it the right side

JOB DONE

You might also like