狠狠撸

狠狠撸Share a Scribd company logo
carlo zapponi 
@littleark 
Bioluminescent creatures of the deep sea 
GOTO Berlin 
Berlin 6th November 2014 
@GOTOber #gotober
Give your proposal a simple and straightforward title.
Clever or inappropriate titles make it harder for people to figure out what you’re really talking about.
Bioluminescent creatures of the deep sea.
what are we really talking about today?
ALGORITHMS
SORTING ALGORITHMS
hold on! don’t run away because we’ll talk about…
VISUALIZING SORTING ALGORITHMS
fun facts
changing face of America
Biol
atlanta falcons
https://twitter.com/mr_mdjones/status/524874356879790080/photo/1
aquaman
Biol
Walter Hickey / BI 
http://www.businessinsider.com/pie-charts-are-the-worst-2013-6
Walter Hickey / BI 
http://www.businessinsider.com/pie-charts-are-the-worst-2013-6
pie charts are the Aquaman of data visualization 
http://www.businessinsider.com/pie-charts-are-the-worst-2013-6
pie charts are good at one thing. comparing 2-3 different data points with very different amounts of information 
http://www.businessinsider.com/pie-charts-are-the-worst-2013-6
Walter Hickey / BI 
http://visual.ly/impact-social-media-pr-industry-infographic // via @WTFViz
I have a 辫谤辞产濒别尘…
carlo, what do you do?
1st try I am a data visualization designer.
Biol
2nd try I study data and I transform them into some type of visual stuff.
Biol
3rd and last try Out there, there is a lot of data generated by people and the environment. Sometime it is very scary to be put face to face with this giant amount of data. My job is to take all the information, understand it and transform it into some type of interactive tool that simplify the understanding of the data. Usually I generate a web application that can be used by people who have no knowledge of the data...
Biol
the answer I like generate order before people’s brains try to do it in their own.
but what is data visualization?
a tool for your eyes and brain to perceive what lies beyond their natural reach. Alberto Cairo – the functional art, 2012
FORM vs BEAUTY
FORM FOLLOWS FUNCTION Louis Sullivan, 1896
Feeling good about an artefact makes us better at using it to accomplish a goal. Don Norman, Emotional Design 2003
FORM vs BEAUTY vs FUN
FORM + BEAUTY + FUN
FUN?
FUN + FUNCTIONALITY
FUNTIONALITY
FUNTIONALITY Experimenting with novel forms is not just an impulse, it’s a necessity. Alberto Cairo – the functional art, 2012
The mind and eye demand stimulation and surprise. Donis Dondis, A Primer of Visual Literacy, 1973
FUN? GREAT, BUT HOW?
Biol
http://bl.ocks.org/mbostock/3231298
http://bl.ocks.org/mbostock/3014589
http://bl.ocks.org/mbostock/1345853
it’s not just D3.js
peoplemov.in
worldshap.in
bolid.es
VISUALIZING SORTING ALGORITHMS
SORTING ALGORITHM a computational process used to organize elements of a sequence in a certain order
0 1 2 3 4 5 6 7 8 9 
0 3 7 1 4 5 2 6 8 9
it all started 飞丑别苍…
https://flic.kr/p/569Stq
Biol
Biol
HOW CAN WE SHOW SORTING ALGORITHMS?
sorting-algorithms.com
sorting-algorithms.com
sortvis.com
sortvis.com - quicksort
sortvis.com – bubblesort
Algorithms – 4th edition
Algorithms – 4th edition
visualization + audibilization
sorting objects
EARLY PROTOTYPES
Biol
Biol
Biol
Biol
Biol
Biol
Biol
Biol
Biol
Biol
Kunstformen der Natur (1904, Ernst Haeckel, Art forms of nature)
Kunstformen der Natur (1904, Ernst Haeckel, Art forms of nature)
Kunstformen der Natur (1904, Ernst Haeckel, Art forms of nature)
Kunstformen der Natur (1904, Ernst Haeckel, Art forms of nature)
Art from code
learning computer science
the beauty of computer science
the beauty of computer science 
+ 
art of coding OR the coding of art
the beauty of computer science 
+ 
art of coding OR the coding of art 
+ 
learning sorting algorithms better
the beauty of computer science 
+ 
art of coding OR the coding of art 
+ 
learning sorting algorithms better 
+ 
exploration with data visualization
www.sorting.at
www.sorting.at
bubble sort O(n^2) 
if the list is already sorted O(n) 
always compare elements next to each other 
also known as the “sinking sort”, “it has only a catchy name” (Donald Knuth)
comb sort O(n^2) 
improves bubblesort by eliminating turtles and rabbits 
gap between compared elements is bigger than 1 and shrinks at every iteration
selection sort O(n^2) 
search for the smallest element and put it in first position 
inefficiently looks for element to be positioned at their right position in the list 
only n swaps, therefore is useful where swapping is expensive
insertion sort O(n^2) 
makes space to the current item by moving larger items to the right 
shifting all elements is expensive
shell sort O(n log n) – O(n ) 
variant of insertion sort based on pre-defined gaps 
works on shrinking gaps, complexity based on the gaps 
2 
3/2
quick sort O(n log n) 
divide and conquer algorithm 
based on partioning and pivot selection 
all elements smaller than the pivot are moved before it, greater after it
heap sort O(n log n) 
improved selection sort by selecting largest element and placing at the end 
uses a heap (b-tree) to rearrange the list 
finding the next largest element takes O(log n)
inversions count 
An inversion is a pair of positions in a sequence where the elements there located are out of their natural order. 
It indicates the distance of that sequence from being sorted. A pair of elements (A[ i ] , A[ j ]) of a sequence A is called an inversion if i<j and A[ i ]>A[ j ].
inversions count 
0 3 7 1 4 5 2 6 8 9
inversions count 
(3,1),(3,2),(7,1),(7,4),(7,5),(7,2),(7,6),(4,2),(5,2) 
0 3 7 1 4 5 2 6 8 9
inversions count 
0 1 2 3 4 5 6 7 8 9 
0 3 7 1 4 5 2 6 8 9 
(3,1),(3,2),(7,1),(7,4),(7,5),(7,2),(7,6),(4,2),(5,2) 
0 3 7 1 4 5 2 6 8 9
www.sorting.at
based on require.js and D3.js
asynchronous code loading 
{ 
“name” : “Bubble Sort”, 
“complexity“ : “O(n )”, 
“wiki” : “http://en.wikipedia.org/wiki/Bubble_sort”, 
“code” : function() { 
var steps=[]; 
function bubblesort(array) { 
//sorting code 
//save each step 
} 
return function(array) { 
bubblesort(array); 
return steps; 
} 
} 
} 
2
3 D3 TIPS
d3.timer 
to repeat batch of operations with requestAnimation frame 
prevent path rendering from locking up the UI 
d3.timer(function(elapsed){ 
element 
.selectAll("path") 
.attr("d",function(d,i){ 
//evaluate path_coordinates 
return path_coordinates; 
}) 
//evaluate flag of end of loop 
return flag; 
})
attrTween(t) + stroke-dashoffset 
to animate the drawing 
The attrTween operator is used when you need a custom interpolator, such as one that understands the semantics of SVG path data 
.transition() 
.duration(DURATION) 
.attrTween("stroke-dashoffset",function(d,i){ 
var len = this.getTotalLength(); 
return function(t) { 
return len*(1-t); 
} 
})
attrTween(t) + path.getPointAtLength(len*t) 
to animate along a path 
.transition() 
.duration(DURATION) 
.attrTween("transform",function(d){ 
return function(t){ 
var len = path.getTotalLength(); 
var p = path.getPointAtLength(len*t); 
return "translate("+p.x+","+p.y]+")"; 
} 
})
Biol
and now 
the best interpretation of 
sorting algorithms EVER
Quick-sort with Hungarian ("Csángó") folk dance
carlo zapponi 
@littleark 
www.makinguse.com 
GOTO Berlin 
@GOTOber #gotober
Ad

Recommended

Fractal proj report 2
Fractal proj report 2
rpiitcbme
?
Chasing Bugs with the BeepBeep Event Stream Processor
Chasing Bugs with the BeepBeep Event Stream Processor
Sylvain Hallé
?
Mapping the world with Twitter
Mapping the world with Twitter
carlo zapponi
?
People Movin
People Movin
carlo zapponi
?
Cross-System Personalization for College Students
Cross-System Personalization for College Students
Peter Brusilovsky
?
Dyablox - Interactive Table
Dyablox - Interactive Table
carlo zapponi
?
Early stage in concept development
Early stage in concept development
carlo zapponi
?
Provide The Key To A First Class Education
Provide The Key To A First Class Education
pjdemees
?
Solving the "Brooklyn Problem"
Solving the "Brooklyn Problem"
Kellan
?
Using Topological Data Analysis on your BigData
Using Topological Data Analysis on your BigData
AnalyticsWeek
?
SP18 Generative Design - Week 2 - Introduction to computational design
SP18 Generative Design - Week 2 - Introduction to computational design
Danil Nagy
?
Lec11lecturlecturlecturlecturlecturlecturlecturlecturcgu_10.ppt
Lec11lecturlecturlecturlecturlecturlecturlecturlecturcgu_10.ppt
KierenReynolds3
?
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Paulo Miguel Almeida
?
Lec11cgu_10.ppt
Lec11cgu_10.ppt
Anjali127411
?
Persistent Data Structures - partial::Conf
Persistent Data Structures - partial::Conf
Ivan Vergiliev
?
Seven Ineffective Coding Habits of Many Programmers
Seven Ineffective Coding Habits of Many Programmers
Kevlin Henney
?
Causal inference-for-profit | Dan McKinley | DN18
Causal inference-for-profit | Dan McKinley | DN18
DataconomyGmbH
?
DN18 | A/B Testing: Lessons Learned | Dan McKinley | Mailchimp
DN18 | A/B Testing: Lessons Learned | Dan McKinley | Mailchimp
Dataconomy Media
?
An introduction to CouchDB
An introduction to CouchDB
David Coallier
?
An Incomplete Introduction to Artificial Intelligence
An Incomplete Introduction to Artificial Intelligence
Steven Beeckman
?
Geospatial Indexing and Search at Scale with Apache Lucene
Geospatial Indexing and Search at Scale with Apache Lucene
Nicholas Knize, Ph.D., GISP
?
A Scala Corrections Library
A Scala Corrections Library
Paul Phillips
?
(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai
Radhika Srinivasan
?
7li7w devcon5
7li7w devcon5
Kerry Buckley
?
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and Akka
Konrad Malawski
?
From Research Objects to Reproducible Science Tales
From Research Objects to Reproducible Science Tales
Bertram Lud?scher
?
Plugging holes — javascript memory leak debugging
Plugging holes — javascript memory leak debugging
Mayflower GmbH
?
graph2tab, a library to convert experimental workflow graphs into tabular for...
graph2tab, a library to convert experimental workflow graphs into tabular for...
Rothamsted Research, UK
?
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
Ameya Patekar
?
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays
?

More Related Content

Similar to Biol (20)

Solving the "Brooklyn Problem"
Solving the "Brooklyn Problem"
Kellan
?
Using Topological Data Analysis on your BigData
Using Topological Data Analysis on your BigData
AnalyticsWeek
?
SP18 Generative Design - Week 2 - Introduction to computational design
SP18 Generative Design - Week 2 - Introduction to computational design
Danil Nagy
?
Lec11lecturlecturlecturlecturlecturlecturlecturlecturcgu_10.ppt
Lec11lecturlecturlecturlecturlecturlecturlecturlecturcgu_10.ppt
KierenReynolds3
?
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Paulo Miguel Almeida
?
Lec11cgu_10.ppt
Lec11cgu_10.ppt
Anjali127411
?
Persistent Data Structures - partial::Conf
Persistent Data Structures - partial::Conf
Ivan Vergiliev
?
Seven Ineffective Coding Habits of Many Programmers
Seven Ineffective Coding Habits of Many Programmers
Kevlin Henney
?
Causal inference-for-profit | Dan McKinley | DN18
Causal inference-for-profit | Dan McKinley | DN18
DataconomyGmbH
?
DN18 | A/B Testing: Lessons Learned | Dan McKinley | Mailchimp
DN18 | A/B Testing: Lessons Learned | Dan McKinley | Mailchimp
Dataconomy Media
?
An introduction to CouchDB
An introduction to CouchDB
David Coallier
?
An Incomplete Introduction to Artificial Intelligence
An Incomplete Introduction to Artificial Intelligence
Steven Beeckman
?
Geospatial Indexing and Search at Scale with Apache Lucene
Geospatial Indexing and Search at Scale with Apache Lucene
Nicholas Knize, Ph.D., GISP
?
A Scala Corrections Library
A Scala Corrections Library
Paul Phillips
?
(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai
Radhika Srinivasan
?
7li7w devcon5
7li7w devcon5
Kerry Buckley
?
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and Akka
Konrad Malawski
?
From Research Objects to Reproducible Science Tales
From Research Objects to Reproducible Science Tales
Bertram Lud?scher
?
Plugging holes — javascript memory leak debugging
Plugging holes — javascript memory leak debugging
Mayflower GmbH
?
graph2tab, a library to convert experimental workflow graphs into tabular for...
graph2tab, a library to convert experimental workflow graphs into tabular for...
Rothamsted Research, UK
?
Solving the "Brooklyn Problem"
Solving the "Brooklyn Problem"
Kellan
?
Using Topological Data Analysis on your BigData
Using Topological Data Analysis on your BigData
AnalyticsWeek
?
SP18 Generative Design - Week 2 - Introduction to computational design
SP18 Generative Design - Week 2 - Introduction to computational design
Danil Nagy
?
Lec11lecturlecturlecturlecturlecturlecturlecturlecturcgu_10.ppt
Lec11lecturlecturlecturlecturlecturlecturlecturlecturcgu_10.ppt
KierenReynolds3
?
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Auckland Programming Algorithms and Performance Meetup about Stacks & LeetCod...
Paulo Miguel Almeida
?
Persistent Data Structures - partial::Conf
Persistent Data Structures - partial::Conf
Ivan Vergiliev
?
Seven Ineffective Coding Habits of Many Programmers
Seven Ineffective Coding Habits of Many Programmers
Kevlin Henney
?
Causal inference-for-profit | Dan McKinley | DN18
Causal inference-for-profit | Dan McKinley | DN18
DataconomyGmbH
?
DN18 | A/B Testing: Lessons Learned | Dan McKinley | Mailchimp
DN18 | A/B Testing: Lessons Learned | Dan McKinley | Mailchimp
Dataconomy Media
?
An introduction to CouchDB
An introduction to CouchDB
David Coallier
?
An Incomplete Introduction to Artificial Intelligence
An Incomplete Introduction to Artificial Intelligence
Steven Beeckman
?
Geospatial Indexing and Search at Scale with Apache Lucene
Geospatial Indexing and Search at Scale with Apache Lucene
Nicholas Knize, Ph.D., GISP
?
A Scala Corrections Library
A Scala Corrections Library
Paul Phillips
?
(Radhika) presentation on chapter 2 ai
(Radhika) presentation on chapter 2 ai
Radhika Srinivasan
?
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and Akka
Konrad Malawski
?
From Research Objects to Reproducible Science Tales
From Research Objects to Reproducible Science Tales
Bertram Lud?scher
?
Plugging holes — javascript memory leak debugging
Plugging holes — javascript memory leak debugging
Mayflower GmbH
?
graph2tab, a library to convert experimental workflow graphs into tabular for...
graph2tab, a library to convert experimental workflow graphs into tabular for...
Rothamsted Research, UK
?

Recently uploaded (20)

QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
Ameya Patekar
?
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays
?
Untitled presentation xcvxcvxcvxcvx.pptx
Untitled presentation xcvxcvxcvxcvx.pptx
jonathan4241
?
Hypothesis Testing Training Material.pdf
Hypothesis Testing Training Material.pdf
AbdirahmanAli51
?
YEAP !NOT WHAT YOU THINK aakshdjdncnkenfj
YEAP !NOT WHAT YOU THINK aakshdjdncnkenfj
payalmistryb
?
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays
?
METHODS OF DATA COLLECTION (Research methodology)
METHODS OF DATA COLLECTION (Research methodology)
anwesha248
?
REGRESSION DIAGNOSTIC II: HETEROSCEDASTICITY
REGRESSION DIAGNOSTIC II: HETEROSCEDASTICITY
Ameya Patekar
?
Data-Driven-Operational--Excellence.pptx
Data-Driven-Operational--Excellence.pptx
NiwanthaThilanjanaGa
?
apidays Singapore 2025 - 4 Identity Essentials for Scaling SaaS in Large Orgs...
apidays Singapore 2025 - 4 Identity Essentials for Scaling SaaS in Large Orgs...
apidays
?
Grade 10 selection and placement (1).pptx
Grade 10 selection and placement (1).pptx
FIDELISMUSEMBI
?
Managed Cloud services - Opsio Cloud Man
Managed Cloud services - Opsio Cloud Man
Opsio Cloud
?
apidays Singapore 2025 - Building Finance Innovation Ecosystems by Umang Moon...
apidays Singapore 2025 - Building Finance Innovation Ecosystems by Umang Moon...
apidays
?
最新版美国威斯康星大学拉克罗斯分校毕业证(鲍奥–尝毕业证书)原版定制
最新版美国威斯康星大学拉克罗斯分校毕业证(鲍奥–尝毕业证书)原版定制
Taqyea
?
Section Three - Project colemanite production China
Section Three - Project colemanite production China
VavaniaM
?
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
bhavaniteacher99
?
Fundamental Analysis for Dummies.pdf somwmdw
Fundamental Analysis for Dummies.pdf somwmdw
ssuserc74044
?
Report_Government Authorities_Index_ENG_FIN.pdf
Report_Government Authorities_Index_ENG_FIN.pdf
OlhaTatokhina1
?
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays
?
apidays New York 2025 - The Future of Small Business Lending with Open Bankin...
apidays New York 2025 - The Future of Small Business Lending with Open Bankin...
apidays
?
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
Ameya Patekar
?
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays
?
Untitled presentation xcvxcvxcvxcvx.pptx
Untitled presentation xcvxcvxcvxcvx.pptx
jonathan4241
?
Hypothesis Testing Training Material.pdf
Hypothesis Testing Training Material.pdf
AbdirahmanAli51
?
YEAP !NOT WHAT YOU THINK aakshdjdncnkenfj
YEAP !NOT WHAT YOU THINK aakshdjdncnkenfj
payalmistryb
?
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays
?
METHODS OF DATA COLLECTION (Research methodology)
METHODS OF DATA COLLECTION (Research methodology)
anwesha248
?
REGRESSION DIAGNOSTIC II: HETEROSCEDASTICITY
REGRESSION DIAGNOSTIC II: HETEROSCEDASTICITY
Ameya Patekar
?
Data-Driven-Operational--Excellence.pptx
Data-Driven-Operational--Excellence.pptx
NiwanthaThilanjanaGa
?
apidays Singapore 2025 - 4 Identity Essentials for Scaling SaaS in Large Orgs...
apidays Singapore 2025 - 4 Identity Essentials for Scaling SaaS in Large Orgs...
apidays
?
Grade 10 selection and placement (1).pptx
Grade 10 selection and placement (1).pptx
FIDELISMUSEMBI
?
Managed Cloud services - Opsio Cloud Man
Managed Cloud services - Opsio Cloud Man
Opsio Cloud
?
apidays Singapore 2025 - Building Finance Innovation Ecosystems by Umang Moon...
apidays Singapore 2025 - Building Finance Innovation Ecosystems by Umang Moon...
apidays
?
最新版美国威斯康星大学拉克罗斯分校毕业证(鲍奥–尝毕业证书)原版定制
最新版美国威斯康星大学拉克罗斯分校毕业证(鲍奥–尝毕业证书)原版定制
Taqyea
?
Section Three - Project colemanite production China
Section Three - Project colemanite production China
VavaniaM
?
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
bhavaniteacher99
?
Fundamental Analysis for Dummies.pdf somwmdw
Fundamental Analysis for Dummies.pdf somwmdw
ssuserc74044
?
Report_Government Authorities_Index_ENG_FIN.pdf
Report_Government Authorities_Index_ENG_FIN.pdf
OlhaTatokhina1
?
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays
?
apidays New York 2025 - The Future of Small Business Lending with Open Bankin...
apidays New York 2025 - The Future of Small Business Lending with Open Bankin...
apidays
?
Ad

Biol