Sunday, September 21, 2014

Algorithms

Algorithms in our Daily lives

Algorithms are basically just a set of instructions. Do we follow a set of instructions to perform functions in our day to day life ? Of course we do.  I've picked getting dressed as my daily algorithm. 
           
Every morning when I wake up I check the temperature so I can dress accordingly. If the temperature is above 70 degrees I consider the weather hot so I wear shorts, tank top and flip flops. If the temperature is between 55-70 degrees I consider the weather moderate so I wear tights, tshirt and tennis shoes. When the temperature is below 55 degrees, I wear jeans, long sleeves shirt, jacket, gloves and boots. 

Can a computer perform this task efficiently ? I think yes- As I'm most proficient in java, I've typed the above algorithm using java code. Consider function dressing_up() and since the function dressing_up() consists of putting on clothes we will need a sub function called wear_item which will take input that is the type of clothing you wish to wear. The table below listing items in your closet. 

TOPS
BOTTOMS
FOOTWEAR
ACCESSORIES
tank_top
shorts
flip_flops
socks
tshirt
tights
sneakers
wool_socks
jacket
jeans
boots
gloves
longsleeved_shirt






dressing_up( int temp ){

if( temp> 70 )
   {wear_item( tank_top );
    wear_item( shorts );
    wear_item( flip_flops );}
else if ( temp> 55 )
    {wear_item( tshirt );
      wear_item( tights );
      wear_item( socks );
      wear_item( sneakers );}
else 
    {wear_item (longsleeved_shirt );
      wear_item( jeans );
      wear_item( jacket );
      wear_item( wool_socks );
      wear_item( boots );
      wear_item( gloves ); }
   

In conclusion I believe a computer can perform the above algorithm if provided the correct hardware. Obviously it might be harder to entirely duplicate the process if one of the above item is dirty but if given adequate if-else instructions, then its possible!

To be very honest I think computers are capable of working with almost all algorithms but might encounter a problem with something as simple as brushing your teeth- I believe so because there are so many different ways to brush your teeth- whether you like to brush your upper jaw first or whether you'd want to go in circular or horizontal motions. It might be hard to feed these algorithms to a computer because there are just too many sets of instructions. 

The above algorithm is not one with the fewest steps- like I mentioned earlier there are different ways to get dressed but this is just the way I prefer to do it. 

When it comes to sharing algorithms, it depends on who I'm sharing it with- if its a human being its easy- by writing instructions down or showing them whereas if its a computer I would type code in the required programming language. 

     

No comments:

Post a Comment