SlideShare a Scribd company logo
Algorithms
a brief introduction
Giacomo Belocchi
Liceo Scientifico 'Giovanni Vailati', Genzano di Roma
14-15-16/02/2018
Who am I?
● Ex Vailati student (2009-2014)
● Computer Engineering Bachelor Degree @Università degli
Studi di ROMA 'Tor Vergata' (2014-2017)
● Computer Engineering Master Degree @Università degli
Studi di ROMA 'Tor Vergata' (2017-present)
● Researcher @CNIT (2017-present): new version of the TCP
protocol & network programmability at transport layer
Some numbers…
● On January 2017 there were 1 062 660 523 registered
hosts on DNS servers [11: Internet System Consortium]
● Global mobile traffic grown by 70% in the last year, and
average mobile connection @ ≥10Mbps in 32 countries
[12: The Akamai’s state of Internet]
● The global average Internet connection speed reached
7.2 Mbps, while global broadband adoption above 10
Mbps was 45% [12]
● 77% of Americans have a smartphone in 2018 [14]
… more numbers
● 73.98% of Italians, 81.45% of Americans, 90.84% of
English have a personal computer [13: The world bank]
Used in a vast variety of fields…
● Education
● Health and medicine
● Science
● Business
● Recreation and entertainment
● Government
● Defense [15]
It’s hard to find a field where it’s not used!
[16]
So many users, so many technologies but...
Chris Bishop
Distinguished Scientist, Microsoft
Research Cambridge
Vice President, The Royal Institution
of Great Britain
Professor of Computer Science,
University of Edinburgh
Computing is transforming our society in ways that are
as profound as the changes wrought by physics and
chemistry in the previous two centuries. Indeed, there is
hardly an aspect of our lives that hasn't already been
influenced, or even revolutionized, by digital technology. Given
the importance of computing to modern society, it is therefore
somewhat paradoxical that there is so little awareness
of the fundamental concepts that make it all possible.
The study of these concepts lies at the heart of
computer science, [...] it is rarely taught in high school.
While an introduction to subjects such as physics and
chemistry is generally considered mandatory, it is often
only at the college or university level that computer
science can be studied in its own right. Furthermore, what
is often taught in schools as “computing” or “ICT”
(information and communication technology) is generally
little more than skills training in the use of software
packages.
[1]
Top500 survey [4]
Sunway TaihuLight,
National Supercomputer Center,
Wuxi, Jiangsu, China
Today
●
Sunway TaihuLight: 93 Petaflops = 93*1015
(1000000000000000)
● 1 FLOP = 1 floating point op / 1 s
● Intel® Core™ i9-7980XE Extreme Edition: 1 Tetaflops =
10¹²
● 10 000 times slower but very fast too!
181 years ago, in 1837...
Charles Babbage, English polymath(mathematician,
philosopher, inventor and mechanical engineer)
The Analytical Engine incorporated an arithmetic logic unit,
control flow in the form of conditional branching and loops,
and integrated memory, making it the first design for a
general-purpose computer that could be described in
modern terms as Turing-complete
“Even steam-powered, the analytical engine would have
been able to compute any computable function” [7]
Von Neumann 1945 [8]
John von Neumann, Hungarian-American mathematician,
physicist, and computer scientist.
● CPU: control (decide what instruction to execute), ALU
(performs basic Arithmetical and logic operations)
● Memory: to store the data alongside the program which use
them
● I/O deivces
A computer is an engine that can execute some set of basic
operations, stored in a program (i.e. an algorithm)
Old but gold! Still used today...
Alan Turing 1936
Alan Mathison Turing, English computer scientist, mathematician,
logician, cryptanalyst, philosopher, and theoretical biologist.
Alan Turing presents the notion of a universal machine, later
called the Turing machine, capable of computing anything
that is computable. The central concept of the modern
computer was based on his ideas.
Computable = can be expressed as an algorithm
Formally defined in his paper “On Computable Numbers, with an
Application to the Entscheidungsproblem”
In short Turing defined the mathematical concept of the Turing
machine and Von Neumann the modern realization of it!
A computer is simply an executor of algorithms.
It’s a Turing machine, it can execute every
program that can be expressed as an algorithm.
Every Turing machine is universal, it can execute
every program.
The only things that change is a more powerful
machine can execute the program faster,
because can execute instructions faster… but
every computer can execute the same basic
operations.
What is an algorithm?
A set of instructions defined step-by-step in a way that can
be executed mechanically, producing a well determined
result.
A sequence of computing steps, which receiving an input
return an output ( A: {input} → {output} ). [19]
Is a precise recipe that specifies the exact sequence of
steps required to solve a problem. [1]
The 0 example: ‘moka algorithm’ [19]
1. open the moka pot
2. fill the water chamber with water
3. put the basket filter
4. fill the basket with the coffee powder
5. screw the upper part on the basis
6. put the moka on an heat source
7. when the coffee is ready turn off the heat source
8. pour coffee in a cup
What I want to stress now
An Algorithm is a
solution to a practical
problem, executed on a
general purpose
machine
1st
problem: searching an item in a list [19]
Suppose we have a list of unsorted
numbers. I have to search a specific
number. How to solve the problem?
The pseudo-code
Algorithm linearSearch( list L, element x ) → bool
for each ( y ∈ L ) do
if ( y = x ) then return FOUND
Return NOT_FOUND
2 main ingredients: the if branch and the for each loop
Is it fast?
● We can measure time
● But it’s computer dependent!
Need of a computer independent metric:
● Based on the input size
● Measure number of steps required (i.e. number of
instructions)
An algorithm is a Sequence of computing steps,
that receiving an input return an output, so
given a certain input it will require some
number of instructions, i.e. some numbers of
steps…
So for the linear search?
Algorithm linearSearch( list L, element x ) → bool
for each ( y ∈ L ) do
if ( y = x ) then return FOUND
Return NOT_FOUND
● The if can be considered as 1 step
● How many time the step is repeated?
● It depends on the size of the input
● Let be N the # of the elements of the list. The if step is
repeated at most N times
● So we can say O(N) is the performance of this algorithm
2nd
problem: searching in a sorted list [19]
Suppose we have a sorted list and we
want to look for an item in the list. The
same as before, but we have that the
elements in the list are now sorted.
Can we solve the problem in a better way?
The pseudo-code [20]
Algorithm binarySearch( list L, element x ) → bool
a ← 1
b ← N
while( there are elements in the sub-list starting in a and
ending in b ) do
m ← ( a + b ) / 2
if( L[ m ] > x ) then b ← m - 1
else if( L[ m ] < x ) then a ← m + 1
else then return FOUND
return NOT_FOUND
3rd
problem: sorting a list
But searching on a ordered list requires the list to
be ordered! So sorting algorithms!
Suppose we have an unsorted list and we want to
make it ordered. So the input is the unsorted list
and the output will be the sorted list.
How can we do it?
The pseudo-code [19, 21, 22]
Algorithm bubbleSort( list L ) → void
while ( there are swaps )
for j from 1 to N
if( L[ j ] > L[ j + 1 ] ) then
swap( L[ j ], L[ j + 1 ] )
What are the performance? O( N² ). There are better algorithms!
4th
problem: ranking search results
Suppose we are searching for some web pages, for
example looking for a certain title.
We want that given a title, it will give us back all the pages
with that title.
We can use a search algorithm for an exact match for sure,
but we can make also more complex queries, but we don’t talk
about that here. The only modification of the algorithm, is
that instead of giving the first page found, it will give the
list of all the pages found.
Modified search algorithm
Algorithm linearSearchModified( list L, title t ) → list R
R ← {}
for each ( y ∈ L ) do
if ( y = t ) then insert page in R
Return R
So from a list of pages, e.g. all the pages of the web, and
a title we can obtain the list of all the pages with that
title.
We can obtain a list of the pages that matches a certain
query. But the # of pages that we get, can be very big.
We are rarely interested in all the results, we are rather
interested in the most relevant results.
The random surfer trick
● A web surfer, choose a random page
● Choose randomly one of the exiting links of the page and go
to the linked page
● Every time the random surfer visit a page, has a probability
of 15% to start a again the surf from a randomly chosen
page (the user get bored...)
Every page has a counter of the # of times the random user has
visited it.
random visitor authority = ‘% of time user spent on that
page in respect of all the time spent on the total of pages’
● hyper-link trick: the more incoming links I have, the
more likely the random user will visit me.
● authority trick: the more authority a page have, more
authority I obtain if that page links me. (more high is
the authority, more incoming link I have, more likely
the user will visit me, and so he will more likely visit
the pages that I link).
Problem? Web spammers, there’s lot of research in fixing that
issue!
Lawrence Edward Page & Sergey Brin
Founded Google on 4th
of September 4 in 1998. Pagerank is the
core of their search engine
Questions?
Thanks!
[1] John MacCormick, 9 Algorithms that changed the future
[2] https://www.top500.org/lists/2017/11/slides/ (Top500)
[3] https://en.wikipedia.org/wiki/TOP500
[4] https://www.top500.org/news/china-tops-supercomputer-
rankings-with-new-93-petaflop-machine/
[5]https://en.wikipedia.org/wiki/Analytical_Engine
[6] https://www.livescience.com/20718-computer-history.html
[7] https://www.newscientist.com/article/mg20827915.500-lets-
build-babbages-ultimate-mechanical-computer/
[8] https://en.wikipedia.org/wiki/Von_Neumann_architecture
[9] https://en.wikipedia.org/wiki/Turing%27s_proof
[10] https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf
[11]http://ftp.isc.org/www/survey/reports/2017/01/(Internet
Systems Consortium)
[12] https://content.akamai.com/gl-en-pg9135-q1-soti-
connectivity.html (The Akamai’s state of the Internet)
[13]https://tcdata360.worldbank.org/indicators/entrp.household.comp
uter?country=ITA&indicator=3427&viz=choropleth&years=2016 The
world bank
[14] http://www.pewinternet.org/fact-sheet/mobile/
[15] http://ecomputernotes.com/fundamental/introduction-to-
computer/uses-of-computer
[16] https://www.gartner.com/smarterwithgartner/top-trends-in-the-
gartner-hype-cycle-for-emerging-technologies-2017/
[17] https://storiografia.me/2013/11/10/ada-lovelace-e-il-primo-
programma-di-calcolo-della-storia/
[18]http://aulascienze.scuola.zanichelli.it/ieri-oggi-scienza/ada-
lovelace-e-il-primo-algoritmo/
[19] Camil Demetrescu, Irene Finocchi, Giuseppe F. Italiano,
Algoritmi e strutture dati
[20] http://rosettacode.org/wiki/Binary_search
[21] http://www.algorithmist.com/index.php/Bubble_sort
[22] https://en.wikipedia.org/wiki/Bubble_sort

More Related Content

What's hot

Introduction to recommender systems
Introduction to recommender systemsIntroduction to recommender systems
Introduction to recommender systems
Arnaud de Myttenaere
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
Sumathi MathanMohan
 
CS375 Presentation-binary sort.pptx
CS375 Presentation-binary sort.pptxCS375 Presentation-binary sort.pptx
CS375 Presentation-binary sort.pptxLiyu Ying
 
Rass presentation
Rass presentationRass presentation
Rass presentation
Shalini Guha
 
stacks and queues for public
stacks and queues for publicstacks and queues for public
stacks and queues for public
iqbalphy1
 
(Kpi summer school 2015) theano tutorial part1
(Kpi summer school 2015) theano tutorial part1(Kpi summer school 2015) theano tutorial part1
(Kpi summer school 2015) theano tutorial part1
Serhii Havrylov
 
introduction
introductionintroduction
introduction
Mohamed Elsayed
 
Complexity
ComplexityComplexity
Complexity
Malainine Zaid
 
Recurrence Relation
Recurrence RelationRecurrence Relation
Recurrence Relation
NilaNila16
 
Data structures and Big O notation
Data structures and Big O notationData structures and Big O notation
Data structures and Big O notation
Muthiah Abbhirami
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
Mohamed Loey
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notationirdginfo
 
Best,worst,average case .17581556 045
Best,worst,average case .17581556 045Best,worst,average case .17581556 045
Best,worst,average case .17581556 045
university of Gujrat, pakistan
 
Applications of data structures
Applications of data structuresApplications of data structures
Applications of data structures
Wipro
 
Introducing TensorFlow: The game changer in building "intelligent" applications
Introducing TensorFlow: The game changer in building "intelligent" applicationsIntroducing TensorFlow: The game changer in building "intelligent" applications
Introducing TensorFlow: The game changer in building "intelligent" applications
Rokesh Jankie
 
Neural Networks with Google TensorFlow
Neural Networks with Google TensorFlowNeural Networks with Google TensorFlow
Neural Networks with Google TensorFlow
Darshan Patel
 
Big o notation
Big o notationBig o notation
Big o notationkeb97
 
Chapter two
Chapter twoChapter two
Chapter two
mihiretu kassaye
 
Big O Notation
Big O NotationBig O Notation
Big O Notation
Marcello Missiroli
 

What's hot (20)

Introduction to recommender systems
Introduction to recommender systemsIntroduction to recommender systems
Introduction to recommender systems
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
CS375 Presentation-binary sort.pptx
CS375 Presentation-binary sort.pptxCS375 Presentation-binary sort.pptx
CS375 Presentation-binary sort.pptx
 
Rass presentation
Rass presentationRass presentation
Rass presentation
 
stacks and queues for public
stacks and queues for publicstacks and queues for public
stacks and queues for public
 
(Kpi summer school 2015) theano tutorial part1
(Kpi summer school 2015) theano tutorial part1(Kpi summer school 2015) theano tutorial part1
(Kpi summer school 2015) theano tutorial part1
 
introduction
introductionintroduction
introduction
 
Complexity
ComplexityComplexity
Complexity
 
Recurrence Relation
Recurrence RelationRecurrence Relation
Recurrence Relation
 
Data structures and Big O notation
Data structures and Big O notationData structures and Big O notation
Data structures and Big O notation
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
 
Best,worst,average case .17581556 045
Best,worst,average case .17581556 045Best,worst,average case .17581556 045
Best,worst,average case .17581556 045
 
Applications of data structures
Applications of data structuresApplications of data structures
Applications of data structures
 
Introducing TensorFlow: The game changer in building "intelligent" applications
Introducing TensorFlow: The game changer in building "intelligent" applicationsIntroducing TensorFlow: The game changer in building "intelligent" applications
Introducing TensorFlow: The game changer in building "intelligent" applications
 
Neural Networks with Google TensorFlow
Neural Networks with Google TensorFlowNeural Networks with Google TensorFlow
Neural Networks with Google TensorFlow
 
Big o notation
Big o notationBig o notation
Big o notation
 
Lec12
Lec12Lec12
Lec12
 
Chapter two
Chapter twoChapter two
Chapter two
 
Big O Notation
Big O NotationBig O Notation
Big O Notation
 

Similar to Algorithms - a brief introduction

DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptx
SayanSen36
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
DeepakYadav656387
 
(1) collections algorithms
(1) collections algorithms(1) collections algorithms
(1) collections algorithms
Nico Ludwig
 
Aad introduction
Aad introductionAad introduction
Aad introductionMr SMAK
 
Algorithms overview
Algorithms overviewAlgorithms overview
Algorithms overview
Deborah Akuoko
 
Module 1_ Introduction.pptx
Module 1_ Introduction.pptxModule 1_ Introduction.pptx
Module 1_ Introduction.pptx
nikshaikh786
 
complexity analysis.pdf
complexity analysis.pdfcomplexity analysis.pdf
complexity analysis.pdf
pasinduneshan
 
A gentle introduction to algorithm complexity analysis
A gentle introduction to algorithm complexity analysisA gentle introduction to algorithm complexity analysis
A gentle introduction to algorithm complexity analysis
Lewis Lin 🦊
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
Computer Hardware & Trouble shooting
 
Introduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searchingIntroduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searching
Mvenkatarao
 
On the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of PythonOn the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of Python
Takeshi Akutsu
 
On the necessity and inapplicability of python
On the necessity and inapplicability of pythonOn the necessity and inapplicability of python
On the necessity and inapplicability of python
Yung-Yu Chen
 
Segment_1_New computer algorithm for cse.pptx
Segment_1_New computer algorithm for cse.pptxSegment_1_New computer algorithm for cse.pptx
Segment_1_New computer algorithm for cse.pptx
fahmidasetu
 
Introduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptxIntroduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptx
esuEthopi
 
Data Structures in C
Data Structures in CData Structures in C
Data Structures in C
Jabs6
 
Pregel
PregelPregel
Pregel
Weiru Dai
 
Natural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usageNatural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usage
hyunyoung Lee
 
RAJAT PROJECT.pptx
RAJAT PROJECT.pptxRAJAT PROJECT.pptx
RAJAT PROJECT.pptx
SayedMohdAsim2
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
Mary Margarat
 

Similar to Algorithms - a brief introduction (20)

DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptx
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
(1) collections algorithms
(1) collections algorithms(1) collections algorithms
(1) collections algorithms
 
Aad introduction
Aad introductionAad introduction
Aad introduction
 
Algorithms overview
Algorithms overviewAlgorithms overview
Algorithms overview
 
Module 1_ Introduction.pptx
Module 1_ Introduction.pptxModule 1_ Introduction.pptx
Module 1_ Introduction.pptx
 
complexity analysis.pdf
complexity analysis.pdfcomplexity analysis.pdf
complexity analysis.pdf
 
A gentle introduction to algorithm complexity analysis
A gentle introduction to algorithm complexity analysisA gentle introduction to algorithm complexity analysis
A gentle introduction to algorithm complexity analysis
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Introduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searchingIntroduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searching
 
On the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of PythonOn the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of Python
 
On the necessity and inapplicability of python
On the necessity and inapplicability of pythonOn the necessity and inapplicability of python
On the necessity and inapplicability of python
 
Segment_1_New computer algorithm for cse.pptx
Segment_1_New computer algorithm for cse.pptxSegment_1_New computer algorithm for cse.pptx
Segment_1_New computer algorithm for cse.pptx
 
Introduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptxIntroduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptx
 
Cs2251 daa
Cs2251 daaCs2251 daa
Cs2251 daa
 
Data Structures in C
Data Structures in CData Structures in C
Data Structures in C
 
Pregel
PregelPregel
Pregel
 
Natural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usageNatural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usage
 
RAJAT PROJECT.pptx
RAJAT PROJECT.pptxRAJAT PROJECT.pptx
RAJAT PROJECT.pptx
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
 

Recently uploaded

FAIR & AI Ready KGs for Explainable Predictions
FAIR & AI Ready KGs for Explainable PredictionsFAIR & AI Ready KGs for Explainable Predictions
FAIR & AI Ready KGs for Explainable Predictions
Michel Dumontier
 
GBSN- Microbiology (Lab 3) Gram Staining
GBSN- Microbiology (Lab 3) Gram StainingGBSN- Microbiology (Lab 3) Gram Staining
GBSN- Microbiology (Lab 3) Gram Staining
Areesha Ahmad
 
general properties of oerganologametal.ppt
general properties of oerganologametal.pptgeneral properties of oerganologametal.ppt
general properties of oerganologametal.ppt
IqrimaNabilatulhusni
 
Viksit bharat till 2047 India@2047.pptx
Viksit bharat till 2047  India@2047.pptxViksit bharat till 2047  India@2047.pptx
Viksit bharat till 2047 India@2047.pptx
rakeshsharma20142015
 
Cancer cell metabolism: special Reference to Lactate Pathway
Cancer cell metabolism: special Reference to Lactate PathwayCancer cell metabolism: special Reference to Lactate Pathway
Cancer cell metabolism: special Reference to Lactate Pathway
AADYARAJPANDEY1
 
Lateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensiveLateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensive
silvermistyshot
 
NuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final versionNuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final version
pablovgd
 
justice-and-fairness-ethics with example
justice-and-fairness-ethics with examplejustice-and-fairness-ethics with example
justice-and-fairness-ethics with example
azzyixes
 
Penicillin...........................pptx
Penicillin...........................pptxPenicillin...........................pptx
Penicillin...........................pptx
Cherry
 
The ASGCT Annual Meeting was packed with exciting progress in the field advan...
The ASGCT Annual Meeting was packed with exciting progress in the field advan...The ASGCT Annual Meeting was packed with exciting progress in the field advan...
The ASGCT Annual Meeting was packed with exciting progress in the field advan...
Health Advances
 
filosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptxfilosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptx
IvanMallco1
 
EY - Supply Chain Services 2018_template.pptx
EY - Supply Chain Services 2018_template.pptxEY - Supply Chain Services 2018_template.pptx
EY - Supply Chain Services 2018_template.pptx
AlguinaldoKong
 
erythropoiesis-I_mechanism& clinical significance.pptx
erythropoiesis-I_mechanism& clinical significance.pptxerythropoiesis-I_mechanism& clinical significance.pptx
erythropoiesis-I_mechanism& clinical significance.pptx
muralinath2
 
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
muralinath2
 
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Sérgio Sacani
 
Hemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptxHemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptx
muralinath2
 
Large scale production of streptomycin.pptx
Large scale production of streptomycin.pptxLarge scale production of streptomycin.pptx
Large scale production of streptomycin.pptx
Cherry
 
Structural Classification Of Protein (SCOP)
Structural Classification Of Protein  (SCOP)Structural Classification Of Protein  (SCOP)
Structural Classification Of Protein (SCOP)
aishnasrivastava
 
Anemia_ different types_causes_ conditions
Anemia_ different types_causes_ conditionsAnemia_ different types_causes_ conditions
Anemia_ different types_causes_ conditions
muralinath2
 
insect taxonomy importance systematics and classification
insect taxonomy importance systematics and classificationinsect taxonomy importance systematics and classification
insect taxonomy importance systematics and classification
anitaento25
 

Recently uploaded (20)

FAIR & AI Ready KGs for Explainable Predictions
FAIR & AI Ready KGs for Explainable PredictionsFAIR & AI Ready KGs for Explainable Predictions
FAIR & AI Ready KGs for Explainable Predictions
 
GBSN- Microbiology (Lab 3) Gram Staining
GBSN- Microbiology (Lab 3) Gram StainingGBSN- Microbiology (Lab 3) Gram Staining
GBSN- Microbiology (Lab 3) Gram Staining
 
general properties of oerganologametal.ppt
general properties of oerganologametal.pptgeneral properties of oerganologametal.ppt
general properties of oerganologametal.ppt
 
Viksit bharat till 2047 India@2047.pptx
Viksit bharat till 2047  India@2047.pptxViksit bharat till 2047  India@2047.pptx
Viksit bharat till 2047 India@2047.pptx
 
Cancer cell metabolism: special Reference to Lactate Pathway
Cancer cell metabolism: special Reference to Lactate PathwayCancer cell metabolism: special Reference to Lactate Pathway
Cancer cell metabolism: special Reference to Lactate Pathway
 
Lateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensiveLateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensive
 
NuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final versionNuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final version
 
justice-and-fairness-ethics with example
justice-and-fairness-ethics with examplejustice-and-fairness-ethics with example
justice-and-fairness-ethics with example
 
Penicillin...........................pptx
Penicillin...........................pptxPenicillin...........................pptx
Penicillin...........................pptx
 
The ASGCT Annual Meeting was packed with exciting progress in the field advan...
The ASGCT Annual Meeting was packed with exciting progress in the field advan...The ASGCT Annual Meeting was packed with exciting progress in the field advan...
The ASGCT Annual Meeting was packed with exciting progress in the field advan...
 
filosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptxfilosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptx
 
EY - Supply Chain Services 2018_template.pptx
EY - Supply Chain Services 2018_template.pptxEY - Supply Chain Services 2018_template.pptx
EY - Supply Chain Services 2018_template.pptx
 
erythropoiesis-I_mechanism& clinical significance.pptx
erythropoiesis-I_mechanism& clinical significance.pptxerythropoiesis-I_mechanism& clinical significance.pptx
erythropoiesis-I_mechanism& clinical significance.pptx
 
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
 
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...
 
Hemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptxHemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptx
 
Large scale production of streptomycin.pptx
Large scale production of streptomycin.pptxLarge scale production of streptomycin.pptx
Large scale production of streptomycin.pptx
 
Structural Classification Of Protein (SCOP)
Structural Classification Of Protein  (SCOP)Structural Classification Of Protein  (SCOP)
Structural Classification Of Protein (SCOP)
 
Anemia_ different types_causes_ conditions
Anemia_ different types_causes_ conditionsAnemia_ different types_causes_ conditions
Anemia_ different types_causes_ conditions
 
insect taxonomy importance systematics and classification
insect taxonomy importance systematics and classificationinsect taxonomy importance systematics and classification
insect taxonomy importance systematics and classification
 

Algorithms - a brief introduction

  • 1. Algorithms a brief introduction Giacomo Belocchi Liceo Scientifico 'Giovanni Vailati', Genzano di Roma 14-15-16/02/2018
  • 2. Who am I? ● Ex Vailati student (2009-2014) ● Computer Engineering Bachelor Degree @Università degli Studi di ROMA 'Tor Vergata' (2014-2017) ● Computer Engineering Master Degree @Università degli Studi di ROMA 'Tor Vergata' (2017-present) ● Researcher @CNIT (2017-present): new version of the TCP protocol & network programmability at transport layer
  • 3. Some numbers… ● On January 2017 there were 1 062 660 523 registered hosts on DNS servers [11: Internet System Consortium] ● Global mobile traffic grown by 70% in the last year, and average mobile connection @ ≥10Mbps in 32 countries [12: The Akamai’s state of Internet] ● The global average Internet connection speed reached 7.2 Mbps, while global broadband adoption above 10 Mbps was 45% [12] ● 77% of Americans have a smartphone in 2018 [14]
  • 4. … more numbers ● 73.98% of Italians, 81.45% of Americans, 90.84% of English have a personal computer [13: The world bank]
  • 5. Used in a vast variety of fields… ● Education ● Health and medicine ● Science ● Business ● Recreation and entertainment ● Government ● Defense [15] It’s hard to find a field where it’s not used!
  • 7.
  • 8. So many users, so many technologies but... Chris Bishop Distinguished Scientist, Microsoft Research Cambridge Vice President, The Royal Institution of Great Britain Professor of Computer Science, University of Edinburgh
  • 9. Computing is transforming our society in ways that are as profound as the changes wrought by physics and chemistry in the previous two centuries. Indeed, there is hardly an aspect of our lives that hasn't already been influenced, or even revolutionized, by digital technology. Given the importance of computing to modern society, it is therefore somewhat paradoxical that there is so little awareness of the fundamental concepts that make it all possible. The study of these concepts lies at the heart of computer science, [...] it is rarely taught in high school. While an introduction to subjects such as physics and chemistry is generally considered mandatory, it is often only at the college or university level that computer science can be studied in its own right. Furthermore, what is often taught in schools as “computing” or “ICT” (information and communication technology) is generally little more than skills training in the use of software packages. [1]
  • 10. Top500 survey [4] Sunway TaihuLight, National Supercomputer Center, Wuxi, Jiangsu, China
  • 11. Today ● Sunway TaihuLight: 93 Petaflops = 93*1015 (1000000000000000) ● 1 FLOP = 1 floating point op / 1 s ● Intel® Core™ i9-7980XE Extreme Edition: 1 Tetaflops = 10¹² ● 10 000 times slower but very fast too!
  • 12. 181 years ago, in 1837... Charles Babbage, English polymath(mathematician, philosopher, inventor and mechanical engineer) The Analytical Engine incorporated an arithmetic logic unit, control flow in the form of conditional branching and loops, and integrated memory, making it the first design for a general-purpose computer that could be described in modern terms as Turing-complete “Even steam-powered, the analytical engine would have been able to compute any computable function” [7]
  • 13.
  • 14. Von Neumann 1945 [8] John von Neumann, Hungarian-American mathematician, physicist, and computer scientist.
  • 15.
  • 16. ● CPU: control (decide what instruction to execute), ALU (performs basic Arithmetical and logic operations) ● Memory: to store the data alongside the program which use them ● I/O deivces A computer is an engine that can execute some set of basic operations, stored in a program (i.e. an algorithm) Old but gold! Still used today...
  • 17. Alan Turing 1936 Alan Mathison Turing, English computer scientist, mathematician, logician, cryptanalyst, philosopher, and theoretical biologist.
  • 18. Alan Turing presents the notion of a universal machine, later called the Turing machine, capable of computing anything that is computable. The central concept of the modern computer was based on his ideas. Computable = can be expressed as an algorithm Formally defined in his paper “On Computable Numbers, with an Application to the Entscheidungsproblem” In short Turing defined the mathematical concept of the Turing machine and Von Neumann the modern realization of it!
  • 19. A computer is simply an executor of algorithms. It’s a Turing machine, it can execute every program that can be expressed as an algorithm. Every Turing machine is universal, it can execute every program. The only things that change is a more powerful machine can execute the program faster, because can execute instructions faster… but every computer can execute the same basic operations.
  • 20. What is an algorithm? A set of instructions defined step-by-step in a way that can be executed mechanically, producing a well determined result. A sequence of computing steps, which receiving an input return an output ( A: {input} → {output} ). [19] Is a precise recipe that specifies the exact sequence of steps required to solve a problem. [1]
  • 21. The 0 example: ‘moka algorithm’ [19] 1. open the moka pot 2. fill the water chamber with water 3. put the basket filter 4. fill the basket with the coffee powder 5. screw the upper part on the basis 6. put the moka on an heat source 7. when the coffee is ready turn off the heat source 8. pour coffee in a cup
  • 22.
  • 23. What I want to stress now An Algorithm is a solution to a practical problem, executed on a general purpose machine
  • 24. 1st problem: searching an item in a list [19] Suppose we have a list of unsorted numbers. I have to search a specific number. How to solve the problem?
  • 25.
  • 26. The pseudo-code Algorithm linearSearch( list L, element x ) → bool for each ( y ∈ L ) do if ( y = x ) then return FOUND Return NOT_FOUND 2 main ingredients: the if branch and the for each loop
  • 27. Is it fast? ● We can measure time ● But it’s computer dependent! Need of a computer independent metric: ● Based on the input size ● Measure number of steps required (i.e. number of instructions)
  • 28. An algorithm is a Sequence of computing steps, that receiving an input return an output, so given a certain input it will require some number of instructions, i.e. some numbers of steps… So for the linear search?
  • 29. Algorithm linearSearch( list L, element x ) → bool for each ( y ∈ L ) do if ( y = x ) then return FOUND Return NOT_FOUND ● The if can be considered as 1 step ● How many time the step is repeated? ● It depends on the size of the input ● Let be N the # of the elements of the list. The if step is repeated at most N times ● So we can say O(N) is the performance of this algorithm
  • 30. 2nd problem: searching in a sorted list [19] Suppose we have a sorted list and we want to look for an item in the list. The same as before, but we have that the elements in the list are now sorted. Can we solve the problem in a better way?
  • 31.
  • 32. The pseudo-code [20] Algorithm binarySearch( list L, element x ) → bool a ← 1 b ← N while( there are elements in the sub-list starting in a and ending in b ) do m ← ( a + b ) / 2 if( L[ m ] > x ) then b ← m - 1 else if( L[ m ] < x ) then a ← m + 1 else then return FOUND return NOT_FOUND
  • 33.
  • 34. 3rd problem: sorting a list But searching on a ordered list requires the list to be ordered! So sorting algorithms! Suppose we have an unsorted list and we want to make it ordered. So the input is the unsorted list and the output will be the sorted list. How can we do it?
  • 35.
  • 36.
  • 37.
  • 38. The pseudo-code [19, 21, 22] Algorithm bubbleSort( list L ) → void while ( there are swaps ) for j from 1 to N if( L[ j ] > L[ j + 1 ] ) then swap( L[ j ], L[ j + 1 ] ) What are the performance? O( N² ). There are better algorithms!
  • 39. 4th problem: ranking search results Suppose we are searching for some web pages, for example looking for a certain title. We want that given a title, it will give us back all the pages with that title. We can use a search algorithm for an exact match for sure, but we can make also more complex queries, but we don’t talk about that here. The only modification of the algorithm, is that instead of giving the first page found, it will give the list of all the pages found.
  • 40. Modified search algorithm Algorithm linearSearchModified( list L, title t ) → list R R ← {} for each ( y ∈ L ) do if ( y = t ) then insert page in R Return R So from a list of pages, e.g. all the pages of the web, and a title we can obtain the list of all the pages with that title. We can obtain a list of the pages that matches a certain query. But the # of pages that we get, can be very big. We are rarely interested in all the results, we are rather interested in the most relevant results.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46. The random surfer trick ● A web surfer, choose a random page ● Choose randomly one of the exiting links of the page and go to the linked page ● Every time the random surfer visit a page, has a probability of 15% to start a again the surf from a randomly chosen page (the user get bored...) Every page has a counter of the # of times the random user has visited it.
  • 47.
  • 48.
  • 49. random visitor authority = ‘% of time user spent on that page in respect of all the time spent on the total of pages’ ● hyper-link trick: the more incoming links I have, the more likely the random user will visit me. ● authority trick: the more authority a page have, more authority I obtain if that page links me. (more high is the authority, more incoming link I have, more likely the user will visit me, and so he will more likely visit the pages that I link). Problem? Web spammers, there’s lot of research in fixing that issue!
  • 50. Lawrence Edward Page & Sergey Brin Founded Google on 4th of September 4 in 1998. Pagerank is the core of their search engine
  • 53. [1] John MacCormick, 9 Algorithms that changed the future [2] https://www.top500.org/lists/2017/11/slides/ (Top500) [3] https://en.wikipedia.org/wiki/TOP500 [4] https://www.top500.org/news/china-tops-supercomputer- rankings-with-new-93-petaflop-machine/ [5]https://en.wikipedia.org/wiki/Analytical_Engine [6] https://www.livescience.com/20718-computer-history.html [7] https://www.newscientist.com/article/mg20827915.500-lets- build-babbages-ultimate-mechanical-computer/ [8] https://en.wikipedia.org/wiki/Von_Neumann_architecture [9] https://en.wikipedia.org/wiki/Turing%27s_proof [10] https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf [11]http://ftp.isc.org/www/survey/reports/2017/01/(Internet Systems Consortium)
  • 54. [12] https://content.akamai.com/gl-en-pg9135-q1-soti- connectivity.html (The Akamai’s state of the Internet) [13]https://tcdata360.worldbank.org/indicators/entrp.household.comp uter?country=ITA&indicator=3427&viz=choropleth&years=2016 The world bank [14] http://www.pewinternet.org/fact-sheet/mobile/ [15] http://ecomputernotes.com/fundamental/introduction-to- computer/uses-of-computer [16] https://www.gartner.com/smarterwithgartner/top-trends-in-the- gartner-hype-cycle-for-emerging-technologies-2017/ [17] https://storiografia.me/2013/11/10/ada-lovelace-e-il-primo- programma-di-calcolo-della-storia/
  • 55. [18]http://aulascienze.scuola.zanichelli.it/ieri-oggi-scienza/ada- lovelace-e-il-primo-algoritmo/ [19] Camil Demetrescu, Irene Finocchi, Giuseppe F. Italiano, Algoritmi e strutture dati [20] http://rosettacode.org/wiki/Binary_search [21] http://www.algorithmist.com/index.php/Bubble_sort [22] https://en.wikipedia.org/wiki/Bubble_sort