Algorithm

Algorithm


  • Derived from the name of the mathematician Muhammed ibn-Musa Al-Khowarizmi, an algorithm is a solution to a problem that meets the following criteria.

  • A list of instructions, procedures, or formula that solves a problem.

  • Can be proven.

  • Something that always finishes and works.

    Example of an algorithm

  • The following algorithm counts the number of letters in a word. We first demonstrate the algorithm using pseudocode, which explains the algorithm in an English-like syntax. The same algorithm is shown in a programming language.

    Algorithm in pseudocode

    Let N = 0
    for each letter in the word
    set N = N + 1

    In the example above, the following is happening.

  • The number we are counting is declared as starting with 0. In this example, we use the letter "N" as our variable, but it could be anything.

  • Start a loop by looking at each letter in the word.

  • For each of the letters encountered, increase the count of "N" by one.

    Algorithm in programming language

    my $word = "hope";
    my $n = 0;
    my @words = split(//, $word);
    foreach (@words) {
    $n++;
    }
    print "Letters: $n";

  • In the above example, which is coded in Perl, the following is happening:

  • The word "hope" is assigned to the $word variable.

  • Our counter is assigned as the $n variable with a starting value of 0.

  • The word "hope" is split by letter and each letter is stored in the @words array.

  • The foreach loop begins going through each element in the array.

  • For each element, the $n counter is increased by one.

  • End of the foreach loop that continues to loop while true.

  • Print the text "Letters: 4" to the screen because there are four letters in "hope."

    How algorithms are used

    Today, algorithms are used billions of times every day for a variety of tasks. Below are a few of the different ways algorithms are used.

  • Algorithms help control traffic lights.

  • Computers use algorithms to convert data (e.g., converting decimal into binary).

  • Google's search uses the PageRank algorithm to sort searched results.

  • Encryption to encrypt and decrypt information and keep data safe is an algorithm.

  • GPS uses algorithms to find the best route to a destination.

  • There are several sort algorithms that sort data.

  • Smartphones, Wi-Fi, and wireless communication use algorithms to communicate.

  • E-mail spam detection uses algorithms to filter out bad e-mails.

  • Data compression for getting information faster (e.g., YouTube video) use algorithms.

  • When was the first algorithm?

  • Because a cooking recipe could be considered an algorithm, the first algorithm could go back as far as written language. However, many find Euclid's algorithm for finding the greatest common divisor to be the first algorithm. This algorithm was first described in 300 B.C.

  • Ada Lovelace is credited as being the first computer programmer and the first person to develop an algorithm for a machine.


    What is an Operating System? » Computer Shortcut Keys and their Functions » Keyboard Function Keys » Computer Basics - Hardware - Software - Parts

    Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students » Success Quotes » English Short Stories for Kids

    Cabin Crew Jobs & Career Advice » Secretary Job Description » Receptionist Job Description » Top 100 Interview Questions and Answers » How to Prepare for an Interview » How to Write a CV » How to Choose a Career » Computer Shortcut Keys and their Functions

    Scholarships in Australia » Scholarships in Austria » Scholarships in Belgium » Scholarships in Canada » Scholarships in Germany » Scholarships in Ireland » Scholarships in Italy » Scholarships in Japan » Scholarships in Korea » Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

    Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

    Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

    Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

    Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK »

  • Click here to post comments

    Join in and write your own page! It's easy to do. How? Simply click here to return to Computer Basics FAQ.