SlideShare a Scribd company logo
Institute for Personal Robots in Education
(IPRE)
CSC 170
Computing: Science and Creativity
●
Alan Winfield of Bristol Robotics Laboratory
●
A Robot tries to save one and then two robots
from falling int a hole |_
Early Algorithms
What is an algorithm?
●
An algorithm is any well-defined
computational procedure that takes some
value or set of values as input and produces
some value or set of values as output
●
The decimal equivalent of a binary number
●
Algorithms can be non computer based
●
Cake recipe, instructions to get to from here to
there, find a number in a phonebook
– Or how back up your contact list on a cell phone
●
Algorithms are much older than computers
●
Dances, ceremonies,
recipes, and building
instructions are all
conceptually similar to
algorithms
●
Babylonians defined some
fundamental mathematical
procedures ~3,600 years
ago
●
Genes contain algorithms!
●
step-by-step processes to
transcribe genes and
produce proteins
Algorithms
Photo credit: Daniel Niles
Algorithms You Might have Used this week
Tie your shoe laces
Wasn’t easy, was it?
Log in to D2L
Enter UA Net ID and
password, press
something
Attended CSc 170
Wake up, do your
routine, drove, walked
or biked nearby …..
Study for a test
Is there really any easy
way?
Algorithms You've Seen in CSC 170
●
Determine a letter grade if..else
●
Interact with the user ask
●
Help a player guess a word in fewer tries
repeat until loop
●
Find if a digit is in a number for loop
●
Create a 5 digit number? secretNumber
Algorithms You Might have Used this week
Luhn algorithm
Credit card number
validation
Recommenders
You might also be
interested in …
PageRank
Google’s way of
measuring “reputation” of
web pages
EdgeRank
Facebook’s method for
determining what is
highest up on your news
feed
Forms of control in algorithms
Sequencing
Application of each step of
an algorithm in order
(sometimes: find order)
Selection
Use of Boolean condition
to select execution parts
Iteration
Repetition of part of an
algorithm until a condition
is met
Recursion
Repeated application of
the same part of
algorithm on smaller
problems
Properties of Algorithms
●
Algorithm + Algorithm = Algorithm
●
Part of Algorithm = Algorithm
●
Several algorithms may solve the same problem,
but in differrent time
●
Much of Computer Science research involves
development of algorithms that solve difficult problems
●
And then implementing them in a programming
language to do it as quickly as possible
●
Believe it or not, it can take seconds or decades
Proving QUARKS exist
●
Kenneth G. Wilson, winner of the 1982
Nobel Prize in physics, found he didn’t
have adequate computing power to
solve his theory numerically, so he
wanted easy ways to use large
numbers of parallel processors.”
●
“He was decades ahead of his time with
respect to computing and networks..”
●
So Wilson became a pioneer in the
field of supercomputing (Cornell)
●
UofA CS and BIOr now looking
forpatterns in terabytes, or trillions
(1,000,000,000,000) of genomic data
Algorithm Correctness
●
We don't only want algorithms to be fast and
efficient; we also want them to be correct!
●
We also have probabalistic and stochastic
algorithms that have a randomness or
probability to report an answer
●
File download time
●
Weather predictions
●
Potential Friends on Facebook
●
Translating text using probabilistic text generation
●
Predicting forest fire danger
●
Discovering terroristic activities
●
Ask the Magic eight ball
https://eightball.tridelphia.net/
How to Express Algorithms…
●
A programmer’s spouse tells him: “Run to the
store and pick up a loaf of bread. If they have
eggs, get a dozen.”
●
The programmer comes home with 12 loaves of bread
●
Algorithms need to be expressed in a context-
free, unambiguous way for all participants
Ways to Express Algorithms
●
Natural Language
●
Pseudo Code
●
Programming
Language
●
Snap! Blocks
Let’s write an algorithm in a natural language
●
Write an algorithm in English that takes a
binary number such as 1010101010 and
reports the decimal equivalent
11012 = 1x23
+ 1x22
+ 0x21
+ 1x20
= 8 + 4 + 0 + 1 = 1310

More Related Content

PPTX
Segment_1_New computer algorithm for cse.pptx
PPT
AOA Week 01.ppt
PDF
ProgFund_Lecture7_Programming_Algorithm.pdf
PDF
Introduction to Algorithms Complexity Analysis
PPTX
L1_Start_of_Learning_of_Algorithms_Basics.pptx
PPTX
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
PPTX
Application of algorithm in real life
PPT
Systems in the small - Introduction to Algorithms
Segment_1_New computer algorithm for cse.pptx
AOA Week 01.ppt
ProgFund_Lecture7_Programming_Algorithm.pdf
Introduction to Algorithms Complexity Analysis
L1_Start_of_Learning_of_Algorithms_Basics.pptx
FDFDRERSFDSGAGAFGGFGFGFGFGAFDGFDGFGFFAGFGGDF
Application of algorithm in real life
Systems in the small - Introduction to Algorithms

Similar to Presentation for the Introductory topic of Algorithms (20)

PPTX
L1_DatabAlgorithm Basics with Design & Analysis.pptx
PDF
Algorithms
PDF
Chapter 3 introduction to algorithms handouts (with notes)
PPTX
Design and Analysis of Algorithm ppt for unit one
PPT
PPT slides - MACHINE PERCEPTION LABORATORY
PDF
Lecture 1 Slides -Introduction to algorithms.pdf
PDF
Lecture 2 role of algorithms in computing
PDF
DAA INTRO.pdf of design analysis algorithms
PPT
AA Lecture 01 of my lecture os ghhhggh.ppt
PPTX
Binary to hexadecimal algorithmic old.pptx
PPT
CP4151 ADSA unit1 Advanced Data Structures and Algorithms
PDF
CP4151 Advanced data structures and algorithms
PPTX
Algo_Lecture01.pptx
PPT
ALGO.ppt
PPTX
1 - Amazing Algorithms (Intro)
PPTX
Algorithm_Presentation_Ixjkmcfsdnm,vznkslds,nf
PPTX
Algorithms and problem solving.pptx
PDF
Unit 1-problem solving with algorithm
PPTX
Chapter 1 - Algorithm Analysis & Design 2021
DOCX
Algorithm - A set of rules for solving operations
L1_DatabAlgorithm Basics with Design & Analysis.pptx
Algorithms
Chapter 3 introduction to algorithms handouts (with notes)
Design and Analysis of Algorithm ppt for unit one
PPT slides - MACHINE PERCEPTION LABORATORY
Lecture 1 Slides -Introduction to algorithms.pdf
Lecture 2 role of algorithms in computing
DAA INTRO.pdf of design analysis algorithms
AA Lecture 01 of my lecture os ghhhggh.ppt
Binary to hexadecimal algorithmic old.pptx
CP4151 ADSA unit1 Advanced Data Structures and Algorithms
CP4151 Advanced data structures and algorithms
Algo_Lecture01.pptx
ALGO.ppt
1 - Amazing Algorithms (Intro)
Algorithm_Presentation_Ixjkmcfsdnm,vznkslds,nf
Algorithms and problem solving.pptx
Unit 1-problem solving with algorithm
Chapter 1 - Algorithm Analysis & Design 2021
Algorithm - A set of rules for solving operations
Ad

Recently uploaded (20)

PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Sustainable Sites - Green Building Construction
PPTX
OOP with Java - Java Introduction (Basics)
DOCX
573137875-Attendance-Management-System-original
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
web development for engineering and engineering
PPTX
Internet of Things (IOT) - A guide to understanding
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Construction Project Organization Group 2.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
Artificial Intelligence
Operating System & Kernel Study Guide-1 - converted.pdf
Sustainable Sites - Green Building Construction
OOP with Java - Java Introduction (Basics)
573137875-Attendance-Management-System-original
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
web development for engineering and engineering
Internet of Things (IOT) - A guide to understanding
Mechanical Engineering MATERIALS Selection
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Construction Project Organization Group 2.pptx
bas. eng. economics group 4 presentation 1.pptx
UNIT 4 Total Quality Management .pptx
III.4.1.2_The_Space_Environment.p pdffdf
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
CH1 Production IntroductoryConcepts.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Artificial Intelligence
Ad

Presentation for the Introductory topic of Algorithms

  • 1. Institute for Personal Robots in Education (IPRE) CSC 170 Computing: Science and Creativity
  • 2. ● Alan Winfield of Bristol Robotics Laboratory ● A Robot tries to save one and then two robots from falling int a hole |_ Early Algorithms
  • 3. What is an algorithm? ● An algorithm is any well-defined computational procedure that takes some value or set of values as input and produces some value or set of values as output ● The decimal equivalent of a binary number ● Algorithms can be non computer based ● Cake recipe, instructions to get to from here to there, find a number in a phonebook – Or how back up your contact list on a cell phone ● Algorithms are much older than computers
  • 4. ● Dances, ceremonies, recipes, and building instructions are all conceptually similar to algorithms ● Babylonians defined some fundamental mathematical procedures ~3,600 years ago ● Genes contain algorithms! ● step-by-step processes to transcribe genes and produce proteins Algorithms Photo credit: Daniel Niles
  • 5. Algorithms You Might have Used this week Tie your shoe laces Wasn’t easy, was it? Log in to D2L Enter UA Net ID and password, press something Attended CSc 170 Wake up, do your routine, drove, walked or biked nearby ….. Study for a test Is there really any easy way?
  • 6. Algorithms You've Seen in CSC 170 ● Determine a letter grade if..else ● Interact with the user ask ● Help a player guess a word in fewer tries repeat until loop ● Find if a digit is in a number for loop ● Create a 5 digit number? secretNumber
  • 7. Algorithms You Might have Used this week Luhn algorithm Credit card number validation Recommenders You might also be interested in … PageRank Google’s way of measuring “reputation” of web pages EdgeRank Facebook’s method for determining what is highest up on your news feed
  • 8. Forms of control in algorithms Sequencing Application of each step of an algorithm in order (sometimes: find order) Selection Use of Boolean condition to select execution parts Iteration Repetition of part of an algorithm until a condition is met Recursion Repeated application of the same part of algorithm on smaller problems
  • 9. Properties of Algorithms ● Algorithm + Algorithm = Algorithm ● Part of Algorithm = Algorithm ● Several algorithms may solve the same problem, but in differrent time ● Much of Computer Science research involves development of algorithms that solve difficult problems ● And then implementing them in a programming language to do it as quickly as possible ● Believe it or not, it can take seconds or decades
  • 10. Proving QUARKS exist ● Kenneth G. Wilson, winner of the 1982 Nobel Prize in physics, found he didn’t have adequate computing power to solve his theory numerically, so he wanted easy ways to use large numbers of parallel processors.” ● “He was decades ahead of his time with respect to computing and networks..” ● So Wilson became a pioneer in the field of supercomputing (Cornell) ● UofA CS and BIOr now looking forpatterns in terabytes, or trillions (1,000,000,000,000) of genomic data
  • 11. Algorithm Correctness ● We don't only want algorithms to be fast and efficient; we also want them to be correct! ● We also have probabalistic and stochastic algorithms that have a randomness or probability to report an answer ● File download time ● Weather predictions ● Potential Friends on Facebook ● Translating text using probabilistic text generation ● Predicting forest fire danger ● Discovering terroristic activities ● Ask the Magic eight ball https://eightball.tridelphia.net/
  • 12. How to Express Algorithms… ● A programmer’s spouse tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.” ● The programmer comes home with 12 loaves of bread ● Algorithms need to be expressed in a context- free, unambiguous way for all participants
  • 13. Ways to Express Algorithms ● Natural Language ● Pseudo Code ● Programming Language ● Snap! Blocks
  • 14. Let’s write an algorithm in a natural language ● Write an algorithm in English that takes a binary number such as 1010101010 and reports the decimal equivalent 11012 = 1x23 + 1x22 + 0x21 + 1x20 = 8 + 4 + 0 + 1 = 1310

Editor's Notes

  • #2: Alan Winfield of Bristol Robotics Laboratory built an experiment where a robot had to save another robot (a proxy for a human) from falling into a hole. Became more interesting when there were two robots to save: robot sometimes saved one, sometimes even saved both; 14 out of 33 times though, it had decision paralysis. Robots follow instructions but does not know why (or the ethics behind it). Imbuing a robot with ethics is a hard problem: important especially with the advent of self-driving cars. Algorithms for military combat robots could be a good starting point – there, robots have an ‘ethical governor’ (a set of algorithms) that helps them make smart decisions in the battlefield. Drones with this programming have been shown to not shoot (or to reduce casualties) in areas protected from combat (like schools and hospitals). Bottom line: We need to know what assumptions we are making when designing the algorithms – the military robots are one field of application where the rules are ‘known’ so it is relatively straightforward to make ‘ethical algorithms’ for them. The interesting part is in trying to get robots to behave well in circumstances that neither it nor we have encountered.
  • #3: Computers are only 50 to 60 years old. Algorithms have been around for thousands and thousands of years. The word itself was seen (in its current form) in the 1690s, though in other variants since the 13th century.
  • #4: Techniques to make a basket, for a ritual ceremony, for the Macarena! Multiplication in elementary school. Babylonians had algorithms to find square roots and to do factorization. Euclid’s algorithm to find the GCD of two numbers is considered to be the oldest algorithm still used today (300 BC). Genes encode proteins: there are start and stop locations (“codons”); there are step-by-step processes to transcribe these genes and produce proteins; these proteins fold and interact with each other, and the environment, in particular ways – these result in life and living processes.
  • #5: Don’t need to be computer based.
  • #6: Length of a word: What if you didn’t have a block for that? Interact with the user: Input/output (I/O) technique Word comparisons: Comparing a secret word with a guessed word until the player has found it Make this a block: Wrap things in functions. Don’t forget: Clicking something triggers an algorithm…
  • #7: Lunh algorithm: used to determine if a particular number is a possibly valid number. It adds a ‘checksum’ digit (a redundant digit) that is appended to the number; if the checksum does not correspond to the rest of the number, then the number is incorrect. Netflix had a contest to improve suggested movies, the prize: One Million Dollars PageRank works by counting the number and quality of links to a page to determine a rough estimate of how important the website is. The underlying assumption is that more important websites are likely to receive more links from other websites EdgeRank algorithm, which used three different factors, has given way to an algorithm that reportedly uses more than 100,000 factors (but is proprietary).
  • #8: Sequencing: When you saw your first program, which blocks go before which? Which steps happen before which steps? Selection: Which part of the code gets executed based on a condition? Forks in a road? If/else? Iteration: Do something over and over until a condition is met. Recursion: You’ll see this later in much more detail. To define something, you use itself on smaller inputs. (Example: Eating chocolate.)
  • #9: Putting together two algorithms to complete two tasks produces an algorithm that now completes both of those tasks. Smaller part of algorithm that does a certain task is also an algorithm that now does a sub-part of a bigger task. There are many ways to do something – examples: Guessing the number from 1 to 100 sequentially or using hints like too small, to large sorting a list using bucket sort is quicker than Bogosort Too look for possibilities of 1 billion friends on Facebook could take 30 years or 30 minutes
  • #10: Tried to determine what happened after the big bang First to propose very expensive computers that run very fast Arizona has BIO5 that runs experiments on DNA generating terabytes of data This comes back to our computer science department to look for patterns, in the hope to do things like cure, o prevent cancer.
  • #11: Algorithms should be correct – this is more important than being fast and efficient. In this class, we will not be too concerned with the efficiency of your algorithm, so long as it is always correct. We might ask you how efficient your algorithm is. TOTAL Correctness: Always returns a value. This is the best scenario for an algorithm (and if it is the most efficient, even better). Examples: Luhn Algorithm, Mathematical Calculations, Encryption and Decryption PARTIAL Correctness: Perfect Numbers (28 is one), the “halting problem”, the “is there a bug in my program?” problem PROBABALISTIC: Getting the exact answer takes a really long time: Traveling Salesman Problem; weather predictions; file download times; existence of a number in a huge, huge list (or the mean); problems where even your input is probabilistic (search queries).
  • #12: “Lather, rinse, repeat” joke. We have yet to reach the goal of programming a robot by speaking to it. NLP (natural language processing) is a hard field because of all the ambiguities in language that computers have yet to be able to understand very well. Context is also very important in natural language (big deal when Google and Bing came out with contextual search.) In the case of the robot with the ethical dilemma, unambiguity is tricky because we may not know of all the possible inputs or contexts. That’s why the output might not always be what you expect – this is another example of a probabilistic algorithm. You truly understand an algorithm when you are able to program a computer to do it – a computer merely follows instructions. The computer is never wrong; the output might not be what you expect, but that’s only because you provided an incorrect or an incomplete program to the computer.
  • #13: Image represents the different ways of specifying an algorithm to do something. Natural Language: Describe your algorithm to me in a way that I can understand and implement it. In fact, one way of refining your algorithm is to talk it out with someone -- through talking, you get to understand the assumptions that you are making that the other person may not make; through talking, you might also stumble through the answer because you are able to tease apart your thoughts. Also, ‘rubber duck debugging’. Pseudo Code: Semi-English; mixed between English and programming language; “code” that is similar to what you might write or drag in your program, but not bound by any language or any syntax is particular. Uses constructs common across languages, such as if-conditionals, while-loops. Can sweep entire assumptions under the rug: “Find the length of a word.” Flowchart: Pictoral representation of an algorithm – squares represent statements; diamonds represent decision points. Programming Language: How you would finally implement an algorithm on a computer. Block diagrams: Yet another way. Move from natural language to pseudo-code to programming language.