SlideShare a Scribd company logo
Algorithms
                               What Is An Algorithm?
                                                       Simply put, an algorithm is a series of
                                                       instructions (a procedure) that solves a
                                                       problem by using a finite number of steps.
                                                       A Computer Scientist would more
                                                       accurately describe an algorithm as an
                                                       effective method expressed as a finite
                                                       list of well-defined instructions for
                                                       calculating a function. Starting from an
                                                       initial state and initial input the instructions
                                                       describe a computation that, when
                                                       executed, will proceed through a finite
Source: Wikipedia                                      number of well-defined successive states,
                      Source:                          eventually      producing        output      and
                      http://en.wikipedia.org/wiki/
                      Algorithm
                                                       terminating at a final ending state.
                                                       (Phew)!

            Information Technology                    ITaCS       and Computer Science
Algorithms: Example 1
                               Food Recipe
                                      A food recipe is a step-by-step procedure
                                      – like a list of instructions - to complete a
                                      task.
                                      A food recipe therefore is like an algorithm.
                                      In this analogy it can be compared to the
                                      software in a system. The hardware is the
                                      oven and the other cooking utensils.
                                      The input is the ingredients and the output
                                      is the cake.




Source: Wikipedia




            Information Technology   ITaCS      and Computer Science
Algorithms: Example 2
                              ―Get To School‖
 1. Walk to bus       1. Get in car      Designing algorithms is about designing
        stop          2. Be driven       solutions to solve problems.
 2. Wait for bus          along City     If you were to design an algorithm to solve
       No.123                Road        the problem of ‗getting to school‘ you
  3. Get on bus     3. Turn left into    would be able to solve this problem in
 4. Ride bus to          Town Lane       several different ways (see left).
       school        4. Car stops in     Different algorithms can solve the same
5. Get off bus at       drop off zone    problem – but in different ways.
     school bus     5. Get out of car    Algorithms that solve the same problem
        stop        6. Walk to class     may differ in length, efficiency and cost.
6. Walk to class                         In computer programming there are many
                                         different ways - algorithms - of solving a
For more examples visit :                problem and completing a task.
http://computer.howstuffworks.com/ques   A computer program can be viewed as an
tion717.htm                              elaborate algorithm.

     Information Technology          ITaCS         and Computer Science
Algorithms: Flowcharts
                   …making your thinking ‗visible‘
Lamp does
 not work                                 Developing a flowchart helps to formalise
                                          the algorithm – and allows more choices,
                                          complexity and variables - crucial as you
  Lamp      No                            move past the simplest of algorithms.
                    Plug in
 plugged
                     lamp
                                          Simple problems can often be shown best
   in?                                    as a flowchart.
Yes
                                          Flowcharts can help you to think logically
                                          about problems by working through each
             Yes                          step.
   Bulb             Replace
 ‘blown’?            bulb
                                          Flowcharts can help you explain your work
                                          to others – and they can follow your
                                          thinking (very useful when trying to ‗fault
No
                   What other steps
                                          find‘ errors /mistakes‘ in your algorithms).
 Repair            could be included in
  lamp             this example?

      Information Technology          ITaCS         and Computer Science
Algorithms: Flowcharts
     A Guide to understanding flow charts




                                                         Source: xkcd.com/518/
                           http://www.cs.nyu.edu/~acase/classes/spring11/intropr
                           og/handouts/notes/class5.pdf stion717.htm




Information Technology   ITaCS       and Computer Science
Algorithms: Pseudocode
                                ….like ‗real‘ code
1.. If student's grade is greater than or    Computer languages need the correct
equal to 60                                  syntax or they do not work properly.
Print "passed"                               Pseudocode has no real syntax rules
else                                         because it is not real computer code – it is
Print "failed"                               a natural language that is close to
                                             ‗computer ‗language.
2. Set total to zero                         The benefit of pseudocode is that it
Set grade counter to one                     enables the programmer to concentrate on
While grade counter is less than or          the algorithms without worrying about all
equal to ten                                 the syntax which is specific to a particular
Input the next grade                         programming language. You can even
Add the grade into the total                 write pseudocode without knowing what
Set the class average to the total           programming language you will use for the
divided by ten                               solution – and others could take your code
Print the class average.                     but use it with a different language!

      Information Technology                ITaCS      and Computer Science
Algorithms On The Internet (1)
                                        PageRank
                                          PageRank is a famous algorithm used by
                                          the Google Internet search engine, that
                                          assigns a numeric value that represents
                                          how important a page is on the web. When
                                          one page links to another page, it is
                                          effectively casting a vote for the other
                                          page. The more votes that are cast for a
                                          page, the more important (in theory) the
                                          page must be. PageRank is Google's way
                                          of deciding a page's importance. It matters
                                          because it is one of the factors that
                                          determines a page's ranking in the search
Cartoon representation of PageRank.
Source Wikipedia:                         results. It isn't the only factor that Google
http://en.wikipedia.org/wiki/PageRank     uses to rank pages, but it is an important
                                          one.

       Information Technology            ITaCS      and Computer Science
Algorithms On The Internet (2)
         EdgeRank / Amazon / Facebook
                           EdgeRank is an algorithm developed by
                           Facebook to govern what is displayed—
                           and how high—on each users News Feed.
                           Amazon uses a number of algorithms. The
                           popularity list algorithm is the accumulated
                           sales of a book‘s last 30 days compared to
                           those in its category–but free books given
                           away only count for roughly 10% of a paid
                           sale, and price is factored in as well, in that
                           the higher your price, the more each sale
                           counts for on the list. Formula:
                           (sales + (0.1 x free downloads)) x
                           (unknown sales factor) / last 30 days.
                           Youtube uses a number of modified
                           Amazon algorithms.

 Information Technology   ITaCS      and Computer Science
Algorithms In The News (1)
                              ‗Right Place Right Time‘
Image: Cutegeek.com
                                               Picture yourself in an expensive designer
                                               clothes shop.
                                               Your smartphone knows where you are –
                                               (thanks to the GPS) - and it alerts your
                                               bank through an automated system that
                                               you've signed up to.
                                               Knowing you've got a history of buying
                                               from similar stores, your bank also knows
                                               that you're running a bit low on cash.
                                               Your phone beeps. A text message. Buy it
                                               in the next 20 minutes and you can borrow
                                               the money at a good rate. Also you'll get
Research: Find out more about this type of     20% off the clothes.
algorithm:                                     You make the purchase – thanks in part to
http://www.bbc.co.uk/news/business-19286426
                                               a ‗right place, right time‘ algorithm.

       Information Technology                 ITaCS     and Computer Science
Algorithms In The News (2)
                                                Google Algorithms Sued
                                                              Bettina Wulff - the wife of a former German
  Image source: http://pulse2.com




                                                              president has filed a lawsuit against
                                                              Google     to      remove       autocomplete
                                                              suggestions that she is claiming as
                                                              libel. Some of the suggestions that pop-up
                                                              when searching for Bettina include the
                                                              words ―prostitute‖ and ―red light‖.
                                                              Head of PR for Google Germany, Kay
                                                              Oberbeck, said the site's search terms
                                                              were "algorithmically generated" and
                                                              "include the popularity of the entered
                                                              search terms".
                                                              "All terms that appear have been
Debate: Can the Google algorithm be manipulated?              previously entered by Google users," he
What problems may a case like this cause for
Google?                                                       added in a statement.

                                    Information Technology   ITaCS      and Computer Science

More Related Content

PPTX
Competitive programming
PPTX
Competitive Programming Guide
PPTX
Competitive programming
PPTX
Competitive Programming
PPTX
Introduction to Competitive programming
PDF
Workshop on programming contest
PPSX
PPTX
Algorithms, flow charts and pseudocodes
Competitive programming
Competitive Programming Guide
Competitive programming
Competitive Programming
Introduction to Competitive programming
Workshop on programming contest
Algorithms, flow charts and pseudocodes

Similar to Algorithm itabq (20)

PPTX
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
PDF
A gentle introduction to algorithm complexity analysis
PPTX
Design and analysis of algorithm lec 1.pptx
PPTX
Algorithm and flowchart2010
PPTX
Chapter 09 design and analysis of algorithms
PDF
ProgFund_Lecture7_Programming_Algorithm.pdf
PDF
Algorithms notes 2 tutorials duniya
PDF
Introduction to Algorithms Complexity Analysis
DOC
Program concep sequential statements
PPT
Unit 1 python (2021 r)
PPTX
Algorithms Data Structures - Algorithms Efficiency.pptx
PPTX
Design and analysis of algorithms Module-I.pptx
PPTX
What is algorithm
PPTX
Presentation for computer studing in algorithm
PPTX
RAJAT PROJECT.pptx
DOCX
Introduction to Programming.docx
PDF
Introduction to data structure and algorithm
PPT
Data sources with unified method and pulbish tes
PDF
Algorithm Analysis.pdf
PPTX
Introduction.pptx
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
A gentle introduction to algorithm complexity analysis
Design and analysis of algorithm lec 1.pptx
Algorithm and flowchart2010
Chapter 09 design and analysis of algorithms
ProgFund_Lecture7_Programming_Algorithm.pdf
Algorithms notes 2 tutorials duniya
Introduction to Algorithms Complexity Analysis
Program concep sequential statements
Unit 1 python (2021 r)
Algorithms Data Structures - Algorithms Efficiency.pptx
Design and analysis of algorithms Module-I.pptx
What is algorithm
Presentation for computer studing in algorithm
RAJAT PROJECT.pptx
Introduction to Programming.docx
Introduction to data structure and algorithm
Data sources with unified method and pulbish tes
Algorithm Analysis.pdf
Introduction.pptx
Ad

More from mckennadglyn (8)

PPTX
Programming basics
PPTX
Programming basics
PPTX
Programming basics
PPTX
Computer legislation
PPT
01 -what_is_an_information_system - copy
PPT
01 -what_is_an_information_system
PDF
Introduction to python
PPTX
Logic diagrams starter teacher version
Programming basics
Programming basics
Programming basics
Computer legislation
01 -what_is_an_information_system - copy
01 -what_is_an_information_system
Introduction to python
Logic diagrams starter teacher version
Ad

Algorithm itabq

  • 1. Algorithms What Is An Algorithm? Simply put, an algorithm is a series of instructions (a procedure) that solves a problem by using a finite number of steps. A Computer Scientist would more accurately describe an algorithm as an effective method expressed as a finite list of well-defined instructions for calculating a function. Starting from an initial state and initial input the instructions describe a computation that, when executed, will proceed through a finite Source: Wikipedia number of well-defined successive states, Source: eventually producing output and http://en.wikipedia.org/wiki/ Algorithm terminating at a final ending state. (Phew)! Information Technology ITaCS and Computer Science
  • 2. Algorithms: Example 1 Food Recipe A food recipe is a step-by-step procedure – like a list of instructions - to complete a task. A food recipe therefore is like an algorithm. In this analogy it can be compared to the software in a system. The hardware is the oven and the other cooking utensils. The input is the ingredients and the output is the cake. Source: Wikipedia Information Technology ITaCS and Computer Science
  • 3. Algorithms: Example 2 ―Get To School‖ 1. Walk to bus 1. Get in car Designing algorithms is about designing stop 2. Be driven solutions to solve problems. 2. Wait for bus along City If you were to design an algorithm to solve No.123 Road the problem of ‗getting to school‘ you 3. Get on bus 3. Turn left into would be able to solve this problem in 4. Ride bus to Town Lane several different ways (see left). school 4. Car stops in Different algorithms can solve the same 5. Get off bus at drop off zone problem – but in different ways. school bus 5. Get out of car Algorithms that solve the same problem stop 6. Walk to class may differ in length, efficiency and cost. 6. Walk to class In computer programming there are many different ways - algorithms - of solving a For more examples visit : problem and completing a task. http://computer.howstuffworks.com/ques A computer program can be viewed as an tion717.htm elaborate algorithm. Information Technology ITaCS and Computer Science
  • 4. Algorithms: Flowcharts …making your thinking ‗visible‘ Lamp does not work Developing a flowchart helps to formalise the algorithm – and allows more choices, complexity and variables - crucial as you Lamp No move past the simplest of algorithms. Plug in plugged lamp Simple problems can often be shown best in? as a flowchart. Yes Flowcharts can help you to think logically about problems by working through each Yes step. Bulb Replace ‘blown’? bulb Flowcharts can help you explain your work to others – and they can follow your thinking (very useful when trying to ‗fault No What other steps find‘ errors /mistakes‘ in your algorithms). Repair could be included in lamp this example? Information Technology ITaCS and Computer Science
  • 5. Algorithms: Flowcharts A Guide to understanding flow charts Source: xkcd.com/518/ http://www.cs.nyu.edu/~acase/classes/spring11/intropr og/handouts/notes/class5.pdf stion717.htm Information Technology ITaCS and Computer Science
  • 6. Algorithms: Pseudocode ….like ‗real‘ code 1.. If student's grade is greater than or Computer languages need the correct equal to 60 syntax or they do not work properly. Print "passed" Pseudocode has no real syntax rules else because it is not real computer code – it is Print "failed" a natural language that is close to ‗computer ‗language. 2. Set total to zero The benefit of pseudocode is that it Set grade counter to one enables the programmer to concentrate on While grade counter is less than or the algorithms without worrying about all equal to ten the syntax which is specific to a particular Input the next grade programming language. You can even Add the grade into the total write pseudocode without knowing what Set the class average to the total programming language you will use for the divided by ten solution – and others could take your code Print the class average. but use it with a different language! Information Technology ITaCS and Computer Science
  • 7. Algorithms On The Internet (1) PageRank PageRank is a famous algorithm used by the Google Internet search engine, that assigns a numeric value that represents how important a page is on the web. When one page links to another page, it is effectively casting a vote for the other page. The more votes that are cast for a page, the more important (in theory) the page must be. PageRank is Google's way of deciding a page's importance. It matters because it is one of the factors that determines a page's ranking in the search Cartoon representation of PageRank. Source Wikipedia: results. It isn't the only factor that Google http://en.wikipedia.org/wiki/PageRank uses to rank pages, but it is an important one. Information Technology ITaCS and Computer Science
  • 8. Algorithms On The Internet (2) EdgeRank / Amazon / Facebook EdgeRank is an algorithm developed by Facebook to govern what is displayed— and how high—on each users News Feed. Amazon uses a number of algorithms. The popularity list algorithm is the accumulated sales of a book‘s last 30 days compared to those in its category–but free books given away only count for roughly 10% of a paid sale, and price is factored in as well, in that the higher your price, the more each sale counts for on the list. Formula: (sales + (0.1 x free downloads)) x (unknown sales factor) / last 30 days. Youtube uses a number of modified Amazon algorithms. Information Technology ITaCS and Computer Science
  • 9. Algorithms In The News (1) ‗Right Place Right Time‘ Image: Cutegeek.com Picture yourself in an expensive designer clothes shop. Your smartphone knows where you are – (thanks to the GPS) - and it alerts your bank through an automated system that you've signed up to. Knowing you've got a history of buying from similar stores, your bank also knows that you're running a bit low on cash. Your phone beeps. A text message. Buy it in the next 20 minutes and you can borrow the money at a good rate. Also you'll get Research: Find out more about this type of 20% off the clothes. algorithm: You make the purchase – thanks in part to http://www.bbc.co.uk/news/business-19286426 a ‗right place, right time‘ algorithm. Information Technology ITaCS and Computer Science
  • 10. Algorithms In The News (2) Google Algorithms Sued Bettina Wulff - the wife of a former German Image source: http://pulse2.com president has filed a lawsuit against Google to remove autocomplete suggestions that she is claiming as libel. Some of the suggestions that pop-up when searching for Bettina include the words ―prostitute‖ and ―red light‖. Head of PR for Google Germany, Kay Oberbeck, said the site's search terms were "algorithmically generated" and "include the popularity of the entered search terms". "All terms that appear have been Debate: Can the Google algorithm be manipulated? previously entered by Google users," he What problems may a case like this cause for Google? added in a statement. Information Technology ITaCS and Computer Science

Editor's Notes

  • #2: Flow chart of an algorithm (Euclid's algorithm) for calculating the greatest common divisor (g.c.d.) of two numbers a and b in locations named A and B. The algorithm proceeds by successive subtractions in two loops: IF the test B ≥ A yields "yes" (or true) (more accurately the numberb in location B is greater than or equal to the numbera in location A) THEN the algorithm specifies B ← B − A (meaning the number b − a replaces the old b). Similarly IF A > B THEN A ← A − B. The process terminates when (the contents of) B is 0, yielding the g.c.d. in A. (Algorithm derived from Scott 2009:13; symbols and drawing style from Tausworthe 1977).Source: http://en.wikipedia.org/wiki/AlgorithmiTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue Please contact [email protected]
  • #3: Image and analogy idea: ediblealgorithms.com/iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue Please contact [email protected]
  • #4: iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue Please contact [email protected]
  • #5: iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue Please contact [email protected]
  • #6: iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue Please contact [email protected]
  • #7: iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue please contact [email protected]
  • #8: iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue please contact [email protected]
  • #9: iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue please contact [email protected]
  • #10: iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue please contact [email protected] uses for this iTAB.Use this iTAB to highlight the use of ICT in society and link to work that you may be doing on algorithmsAll iTABs have been cross-referenced against the GCSE ICT Specifications from EdExcel, OCR and AQA as well as against the Cambridge Nationals. iTABs are also cross referenced against the existing Programme of Study for ICT at KS3 and KS4. Use iTABs for:Starter / plenary activities. What's hot/what's not cool-wall. A rolling slide show. Use the prompt in red to promote discussion in a lesson or for homework. Useful materials for debates / group and paired work.iTABs and the iTABs idea are © ICTCPD1 .You are free to use, edit or otherwise manipulate iTABs but only in the school purchasing iTABS. You can share with colleagues within the same site! For use on stand-alone computers, Intranets, secure / closed portals and VLEs within the purchasing school. Permissions regarding wider publication – e.g. on your school website, please contact [email protected]
  • #11: iTaCS is an occasional set of resources to support the study of Information Technology and Computer Science and are free to use. iTABs and the iTABs idea are weekly published resources, reflecting ICT, IT and CS news stories with supporting activities to support the teaching of ICT, IT and CS. For a free sample of our back-catalogue please contact [email protected] uses for this iTAB.Use this iTAB to highlight the use of ICT in society and link to work that you may be doing on algorithmsAll iTABs have been cross-referenced against the GCSE ICT Specifications from EdExcel, OCR and AQA as well as against the Cambridge Nationals. iTABs are also cross referenced against the existing Programme of Study for ICT at KS3 and KS4. Use iTABs for:Starter / plenary activities. What's hot/what's not cool-wall. A rolling slide show. Use the prompt in red to promote discussion in a lesson or for homework. Useful materials for debates / group and paired work.iTABs and the iTABs idea are © ICTCPD1 .You are free to use, edit or otherwise manipulate iTABs but only in the school purchasing iTABS. You can share with colleagues within the same site! For use on stand-alone computers, Intranets, secure / closed portals and VLEs within the purchasing school. Permissions regarding wider publication – e.g. on your school website, please contact [email protected]