SlideShare a Scribd company logo
Algorithms Presentation
Group 5
Agenda Items and Presenters
Bell Numbers
All Pairs Shortest Path
Shell Sort and Radix Sort Psuedocode
Bell Numbers

A Use Case

In how many ways, counting ties, can 8 horses cross a finish line?
Bell Numbers

Horse Racing Example

Let’s consider just four horses for now and develop a recurrence
relation, a systematic way of counting the possible outcomes.
In mathematics, a recurrence relation is an equation that recursively
defines a sequence, one or more initial terms are given: each further
term of the sequence is defined as a function of the preceding terms.
Four horses may finish in one, two, three or four “blocks”.
Define “blocks”…
A block in this case is a pattern of possible ways the horses can
finish.
If we have fours horses as follows…
Bell Numbers
Alfred
Bell Numbers
Boxtrot
Bell Numbers
Yisele
Bell Numbers
Xray
Bell Numbers

More Background Info

Three block example:
(Alpha) (Boxtrot) (Yisele, Xray) have finished separately.
Yisele and Xray have tied.
Bell Numbers

Blocks

Three blocks – (Alpha), (Beta), (Yisele, Xray) may be arranged in 3!
= 6 ways.
The arrangements for a block of three ways in which the horses can
finish.
Note: This does not take into account places (first, second, third,
fourth).
(Alpha) (Boxtrot) (Yisele, Xray), (Alpha) (Yisele) (Boxtrot, Xray),
(Alpha) (Xray) (Boxtro, Yisele), (Boxtrot) (Yisele) (Alpha, Xray),
(Boxtrot) (Xray) (Alpha, Yisele), (Yisele) (Xray) (Alpha, Beta)
Bell Numbers

Blocks, Partitions
Arrangements and Outcomes

# Blocks Partitions
1
(Alpha, Boxtrot, Yisele, Xray)

Total Partitions
1

Arrangements per Partition
1!

Outcomes Possible
1

2

(Alpha) (Boxtrot, Yisele, Xray) , (Boxtrot) (Alpha, Yisele, Xray),
(Yisele) (Alpha, Boxtrot, Xray), (Xray) (Alpha, Boxtrot, Yisele).
(Alpha, Boxtrot) (Yisele, Xray), (Alpha, Yisele) (Boxtrot, Xray),
(Alpha, Xray) (Boxtrot, Yisele)

7

2!

14

3

(Alpha) (Boxtrot) (Yisele, Xray), (Alpha) (Yisele) (Boxtrot, Xray),
(Alpha) (Xray) (Boxtro, Yisele), (Boxtrot) (Yisele) (Alpha, Xray),
(Boxtrot) (Xray) (Alpha, Yisele), (Yisele) (Xray) (Alpha, Beta)

6

3!

36

4

(Alpha) (Boxtrot) (Yisele) (Xray)

1
15

4!

24

Bell Number

The number of ways a set of n elements can be partitioned into m
nonempty subsets S(n,m) is the Bell number. In this case 4
horses (elements) can be partitioned in 15 different ways. In this
case we added it up manually but we can determine a formula
and also a graphical way to calculate as follows….
Bell Numbers Calculate Graphically

The numbers can be constructed by using the Bell Triangle. Start
with a row with the number one. Afterward each row begins with the
last number of the previous row and continues to the right adding
each number to the number above it to get the next number in the
row..
Bell Numbers

The Formula

S(n+1) = S(n,m-1) + m * S(n,m)
n = elements
m = blocks
B(5) = S(5,1) + S(5,2) + S(5,3) + S(5,4) + S(5,5)
Answer to the Problem
H8 =
Where S(n,k) denotes the # ways n horses can cross in k blocks.
H8 = 1×1! + 127×2! + 966×3! + 1701×4! +
1050×5! + 266×6! + 28×7! + 1×8!
= 545835.
H8 denotes the number of ways 8 horses can cross the finish line.
Bell Numbers

Psuedocode

How do you represent a partitioning of a set of n elements?
(This example is somewhat more challenging that the previous ones. Feel free to skim it, and
go on.) The n’th Bell number Bn is the number of ways of partitioning n (distinct) objects. One
way of computing the Bell numbers is by using the following double recursive algorithm. This
algorithm computes numbers with two arguments: B(i,j). The n’th Bell number, Bn is computed
as
B(n,n). For example to find B3 compute B(3,3).1
B(1,1) = 1.
B(n,1) = B(n-1,n-1) for n > 1.
B(i,j) = B(i-1,j-1) + B(i,j-1) for n > 1 and 1 < j # i.

Technical Information:
Language:
Objects:
All Pairs Shortest Path
Given a weighted graph G(V,E,w), the all-pairs shortest paths
problem is to find the shortest paths between all pairs of vertices vi,
vj ∈ V.
A number of algorithms are known for solving this problem.
All Pairs Shortest Path
Consider the multiplication of the weighted adjacency matrix with itself
- except, in this case, we replace the multiplication operation in matrix
multiplication by addition, and the addition operation by minimization.
Notice that the product of weighted adjacency matrix with itself
returns a matrix that contains shortest paths of length 2 between any
pair of nodes.
It follows from this argument that An contains all shortest paths.
Transitive Closure : of R is the smallest transitive relation containing R.
All Pairs Shortest Path
0

0

1

0

0

0

1

0

0

1

0

1

0

1

0

1

0

0

0

1

0

0

0

1

0

1

0

0

0

1

0

0

R
R[i,j] = {

P1
1
0

Pk [i,j] = {

1
0

If there is a path of
exactly K from i-> j
All Pairs Shortest Path
0

0

0

1

0

1

0

0

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

P3

P2
0

1

0

1

0

1

1

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

0

1

P4

P = P1 + P2+P3+P4
All Pairs Shortest Path
An is computed by doubling powers - i.e., as A, A2, A4, A8, and so on.
We need log n matrix multiplications, each taking time O(n3).
The serial complexity of this procedure is O(n3log n).
This algorithm is not optimal, since the best known algorithms have
complexity O(n3).
All Pairs Shortest Path

Parallel Formulation

Each of the log n matrix multiplications can be performed in parallel.
We can use n3/log n processors to compute each matrix-matrix
product in time log n.
The entire process takes O(log2n) time.
All Pairs Shortest Path

Parallel Formulation

def adj2(i,j):
if adj(i,j) == 1:
return 1
else:
for k in range(0,n): # where n is the number of vertices in G
if adj(i,k) == 1 and adj(k,j) == 1:
return 1
return 0
Shell Sort – Example 1
Initial Segmenting Gap = 4
80 93 60 12 42 30 68 85 10

10 30 60 12 42 93 68 85

80
Shell Sort – Example 2
Resegmenting Gap = 2
10 30 60

12 42 93 68 85 80

10 12 42

30 60 85 68 93 80
Shell Sort – Example 3
Resegmenting Gap = 1
10 12 42

30 60 85 68 93 80

10 12 30

42 60 68 80 85 93
Shell Sort

Psuedocode

# Sort an array a[0...n-1].
gaps = [701, 301, 132, 57, 23, 10, 4, 1]
foreach (gap in gaps)
{
# Do an insertion sort for each gap size.
for (i = gap; i < n; i += 1)
{
temp = a[i]
for (j = i; j >= gap and a[j - gap] > temp; j -= gap)
{
a[j] = a[j - gap]
}
a[j] = temp
}
}

Technical Information:
Language:
Programming Constructs:
Efficiency:
Radix Sort
For simplicity, say you want to use the decimal radix (=10) for sorting. Then you would start
by separating the numbers by units and then putting them together again; next you would
separate the numbers by tens and then put them together again; then by hundreds and so on
until all the numbers are sorted. Each time you loop, just read the list from left to right. You
can also imagine you are separating the numbers into buckets. Here is an illustration using
Radix Sort
5, 213, 55, 21, 2334, 31, 20, 430
Separate by units:
zeros: 20, 430
ones: 21, 31
twos:
threes: 213
fours: 2334
fives: 5, 55
Back together: 20, 430, 21, 31, 213, 2334, 5, 55
To put them back together, first read the zeroes bucket, then the ones bucket, then so on,
until you read the nines bucket.
Radix Sort
Separate by tens:
zeros: 05
ones: 213
twos: 20, 21
threes: 430, 2334,
fours:
fives: 55
Back together: 5, 213, 20, 21, 430, 2334, 55
Radix Sort
Separate by hundreds:
zeros: 005, 020, 021, 055
ones:
twos: 213
threes: 2334
fours: 430
fives:
Back together: 5, 20, 21, 55, 213, 2334, 430
Radix Sort
Separate by thousands:
zeros: 0005, 0020, 0021, 0055,0213, 0430
ones:
twos: 2334
threes:
fours:
fives:
Back together: 5, 20, 21, 55, 213, 430, 2334
Thank You

More Related Content

What's hot

Top school in noida
Top school in noidaTop school in noida
Top school in noida
Edhole.com
 
27 calculation with log and exp x
27 calculation with log and exp x27 calculation with log and exp x
27 calculation with log and exp x
math260
 
Introduction to Elliptic Curve Cryptography
Introduction to Elliptic Curve CryptographyIntroduction to Elliptic Curve Cryptography
Introduction to Elliptic Curve Cryptography
David Evans
 
Mathematicalfoundationofcomputerscience
MathematicalfoundationofcomputerscienceMathematicalfoundationofcomputerscience
Mathematicalfoundationofcomputerscience
jntuworld
 
5.5 back track
5.5 back track5.5 back track
5.5 back track
Krish_ver2
 
Cs2303 theory of computation all anna University question papers
Cs2303 theory of computation all anna University question papersCs2303 theory of computation all anna University question papers
Cs2303 theory of computation all anna University question papers
appasami
 
4.5 calculation with log and exp
4.5 calculation with log and exp4.5 calculation with log and exp
4.5 calculation with log and expmath260
 
Chapter 22 Finite Field
Chapter 22 Finite FieldChapter 22 Finite Field
Chapter 22 Finite Field
Tony Cervera Jr.
 
Cs6660 compiler design november december 2016 Answer key
Cs6660 compiler design november december 2016 Answer keyCs6660 compiler design november december 2016 Answer key
Cs6660 compiler design november december 2016 Answer key
appasami
 
Elliptic Curve Cryptography for those who are afraid of maths
Elliptic Curve Cryptography for those who are afraid of mathsElliptic Curve Cryptography for those who are afraid of maths
Elliptic Curve Cryptography for those who are afraid of maths
Martijn Grooten
 
Galois field
Galois fieldGalois field
Galois field
Niaj Morshed
 
DSA (Data Structure and Algorithm) Questions
DSA (Data Structure and Algorithm) QuestionsDSA (Data Structure and Algorithm) Questions
DSA (Data Structure and Algorithm) Questions
RESHAN FARAZ
 
28 more on log and exponential equations x
28 more on log and exponential equations x28 more on log and exponential equations x
28 more on log and exponential equations x
math260
 
K map
K mapK map
2.5 computations of derivatives
2.5 computations of derivatives2.5 computations of derivatives
2.5 computations of derivativesmath265
 
5.3 areas, riemann sums, and the fundamental theorem of calaculus
5.3 areas, riemann sums, and the fundamental theorem of calaculus5.3 areas, riemann sums, and the fundamental theorem of calaculus
5.3 areas, riemann sums, and the fundamental theorem of calaculusmath265
 
Backtracking
Backtracking  Backtracking
Backtracking
Vikas Sharma
 
Error control coding bch, reed-solomon etc..
Error control coding   bch, reed-solomon etc..Error control coding   bch, reed-solomon etc..
Error control coding bch, reed-solomon etc..
Madhumita Tamhane
 

What's hot (20)

Top school in noida
Top school in noidaTop school in noida
Top school in noida
 
27 calculation with log and exp x
27 calculation with log and exp x27 calculation with log and exp x
27 calculation with log and exp x
 
Introduction to Elliptic Curve Cryptography
Introduction to Elliptic Curve CryptographyIntroduction to Elliptic Curve Cryptography
Introduction to Elliptic Curve Cryptography
 
Mathematicalfoundationofcomputerscience
MathematicalfoundationofcomputerscienceMathematicalfoundationofcomputerscience
Mathematicalfoundationofcomputerscience
 
5.5 back track
5.5 back track5.5 back track
5.5 back track
 
Cs2303 theory of computation all anna University question papers
Cs2303 theory of computation all anna University question papersCs2303 theory of computation all anna University question papers
Cs2303 theory of computation all anna University question papers
 
4.5 calculation with log and exp
4.5 calculation with log and exp4.5 calculation with log and exp
4.5 calculation with log and exp
 
Chapter 22 Finite Field
Chapter 22 Finite FieldChapter 22 Finite Field
Chapter 22 Finite Field
 
5th Semester Electronic and Communication Engineering (2013-June) Question Pa...
5th Semester Electronic and Communication Engineering (2013-June) Question Pa...5th Semester Electronic and Communication Engineering (2013-June) Question Pa...
5th Semester Electronic and Communication Engineering (2013-June) Question Pa...
 
Cs6660 compiler design november december 2016 Answer key
Cs6660 compiler design november december 2016 Answer keyCs6660 compiler design november december 2016 Answer key
Cs6660 compiler design november december 2016 Answer key
 
Elliptic Curve Cryptography for those who are afraid of maths
Elliptic Curve Cryptography for those who are afraid of mathsElliptic Curve Cryptography for those who are afraid of maths
Elliptic Curve Cryptography for those who are afraid of maths
 
Galois field
Galois fieldGalois field
Galois field
 
U0 vqmtq3mja=
U0 vqmtq3mja=U0 vqmtq3mja=
U0 vqmtq3mja=
 
DSA (Data Structure and Algorithm) Questions
DSA (Data Structure and Algorithm) QuestionsDSA (Data Structure and Algorithm) Questions
DSA (Data Structure and Algorithm) Questions
 
28 more on log and exponential equations x
28 more on log and exponential equations x28 more on log and exponential equations x
28 more on log and exponential equations x
 
K map
K mapK map
K map
 
2.5 computations of derivatives
2.5 computations of derivatives2.5 computations of derivatives
2.5 computations of derivatives
 
5.3 areas, riemann sums, and the fundamental theorem of calaculus
5.3 areas, riemann sums, and the fundamental theorem of calaculus5.3 areas, riemann sums, and the fundamental theorem of calaculus
5.3 areas, riemann sums, and the fundamental theorem of calaculus
 
Backtracking
Backtracking  Backtracking
Backtracking
 
Error control coding bch, reed-solomon etc..
Error control coding   bch, reed-solomon etc..Error control coding   bch, reed-solomon etc..
Error control coding bch, reed-solomon etc..
 

Viewers also liked

COM1407: File Processing
COM1407: File Processing COM1407: File Processing
COM1407: File Processing
Hemantha Kulathilake
 
COM1407: Program Control Structures – Repetition and Loops
COM1407: Program Control Structures – Repetition and Loops COM1407: Program Control Structures – Repetition and Loops
COM1407: Program Control Structures – Repetition and Loops
Hemantha Kulathilake
 
Basic Programming Concept
Basic Programming ConceptBasic Programming Concept
Basic Programming Concept
Cma Mohd
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchartlotlot
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowchartsnicky_walters
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowcharthermiraguilar
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
Hemantha Kulathilake
 
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codeshermiraguilar
 
pseudo code basics
pseudo code basicspseudo code basics
pseudo code basics
Sabik T S
 
Flowchart pseudocode-examples
Flowchart pseudocode-examplesFlowchart pseudocode-examples
Flowchart pseudocode-examples
Gautam Roy
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languagesVarun Garg
 

Viewers also liked (11)

COM1407: File Processing
COM1407: File Processing COM1407: File Processing
COM1407: File Processing
 
COM1407: Program Control Structures – Repetition and Loops
COM1407: Program Control Structures – Repetition and Loops COM1407: Program Control Structures – Repetition and Loops
COM1407: Program Control Structures – Repetition and Loops
 
Basic Programming Concept
Basic Programming ConceptBasic Programming Concept
Basic Programming Concept
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowchart
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
 
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codes
 
pseudo code basics
pseudo code basicspseudo code basics
pseudo code basics
 
Flowchart pseudocode-examples
Flowchart pseudocode-examplesFlowchart pseudocode-examples
Flowchart pseudocode-examples
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 

Similar to Algorithms presentation on Path Matrix, Bell Number and Sorting

Sorting2
Sorting2Sorting2
Sorting2
Saurabh Mishra
 
pradeepbishtLecture13 div conq
pradeepbishtLecture13 div conqpradeepbishtLecture13 div conq
pradeepbishtLecture13 div conq
Pradeep Bisht
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programmingDamian T. Gordon
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
Programming Homework Help
 
Square Root Decomposition
Square Root DecompositionSquare Root Decomposition
Square Root Decomposition
Mohammed Ashiqur Rahman Baig
 
Theory of Computation "Chapter 1, introduction"
Theory of Computation "Chapter 1, introduction"Theory of Computation "Chapter 1, introduction"
Theory of Computation "Chapter 1, introduction"
Ra'Fat Al-Msie'deen
 
Review session2
Review session2Review session2
Review session2
NEEDY12345
 
Hidden Markov Model in Natural Language Processing
Hidden Markov Model in Natural Language ProcessingHidden Markov Model in Natural Language Processing
Hidden Markov Model in Natural Language Processing
sachinmaskeen211
 
Algorithm Exam Help
Algorithm Exam HelpAlgorithm Exam Help
Algorithm Exam Help
Programming Exam Help
 
Lecture 01 reals number system
Lecture 01 reals number systemLecture 01 reals number system
Lecture 01 reals number system
Hazel Joy Chong
 
file_5.pptx
file_5.pptxfile_5.pptx
MFCS UNIT-III.pptx
MFCS UNIT-III.pptxMFCS UNIT-III.pptx
MFCS UNIT-III.pptx
CM003ShanthanAbboju
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
vsssuresh
 
lecture 17
lecture 17lecture 17
lecture 17sajinsc
 
14078956.ppt
14078956.ppt14078956.ppt
14078956.ppt
Sivam Chinna
 
Counting Sort Lowerbound
Counting Sort LowerboundCounting Sort Lowerbound
Counting Sort Lowerbounddespicable me
 
Arithmetic Progression & Geometric ProgresionP
Arithmetic Progression & Geometric ProgresionPArithmetic Progression & Geometric ProgresionP
Arithmetic Progression & Geometric ProgresionP
ibha1234
 
Arithmetic And Geometric Progressions
Arithmetic And Geometric ProgressionsArithmetic And Geometric Progressions
Arithmetic And Geometric Progressions
Finni Rice
 
Ap gp
Ap gpAp gp
Ap gp
sujoy7
 
Algorithms Exam Help
Algorithms Exam HelpAlgorithms Exam Help
Algorithms Exam Help
Programming Exam Help
 

Similar to Algorithms presentation on Path Matrix, Bell Number and Sorting (20)

Sorting2
Sorting2Sorting2
Sorting2
 
pradeepbishtLecture13 div conq
pradeepbishtLecture13 div conqpradeepbishtLecture13 div conq
pradeepbishtLecture13 div conq
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programming
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
Square Root Decomposition
Square Root DecompositionSquare Root Decomposition
Square Root Decomposition
 
Theory of Computation "Chapter 1, introduction"
Theory of Computation "Chapter 1, introduction"Theory of Computation "Chapter 1, introduction"
Theory of Computation "Chapter 1, introduction"
 
Review session2
Review session2Review session2
Review session2
 
Hidden Markov Model in Natural Language Processing
Hidden Markov Model in Natural Language ProcessingHidden Markov Model in Natural Language Processing
Hidden Markov Model in Natural Language Processing
 
Algorithm Exam Help
Algorithm Exam HelpAlgorithm Exam Help
Algorithm Exam Help
 
Lecture 01 reals number system
Lecture 01 reals number systemLecture 01 reals number system
Lecture 01 reals number system
 
file_5.pptx
file_5.pptxfile_5.pptx
file_5.pptx
 
MFCS UNIT-III.pptx
MFCS UNIT-III.pptxMFCS UNIT-III.pptx
MFCS UNIT-III.pptx
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
lecture 17
lecture 17lecture 17
lecture 17
 
14078956.ppt
14078956.ppt14078956.ppt
14078956.ppt
 
Counting Sort Lowerbound
Counting Sort LowerboundCounting Sort Lowerbound
Counting Sort Lowerbound
 
Arithmetic Progression & Geometric ProgresionP
Arithmetic Progression & Geometric ProgresionPArithmetic Progression & Geometric ProgresionP
Arithmetic Progression & Geometric ProgresionP
 
Arithmetic And Geometric Progressions
Arithmetic And Geometric ProgressionsArithmetic And Geometric Progressions
Arithmetic And Geometric Progressions
 
Ap gp
Ap gpAp gp
Ap gp
 
Algorithms Exam Help
Algorithms Exam HelpAlgorithms Exam Help
Algorithms Exam Help
 

Recently uploaded

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 

Recently uploaded (20)

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 

Algorithms presentation on Path Matrix, Bell Number and Sorting

  • 2. Agenda Items and Presenters Bell Numbers All Pairs Shortest Path Shell Sort and Radix Sort Psuedocode
  • 3. Bell Numbers A Use Case In how many ways, counting ties, can 8 horses cross a finish line?
  • 4. Bell Numbers Horse Racing Example Let’s consider just four horses for now and develop a recurrence relation, a systematic way of counting the possible outcomes. In mathematics, a recurrence relation is an equation that recursively defines a sequence, one or more initial terms are given: each further term of the sequence is defined as a function of the preceding terms. Four horses may finish in one, two, three or four “blocks”. Define “blocks”… A block in this case is a pattern of possible ways the horses can finish. If we have fours horses as follows…
  • 9. Bell Numbers More Background Info Three block example: (Alpha) (Boxtrot) (Yisele, Xray) have finished separately. Yisele and Xray have tied.
  • 10. Bell Numbers Blocks Three blocks – (Alpha), (Beta), (Yisele, Xray) may be arranged in 3! = 6 ways. The arrangements for a block of three ways in which the horses can finish. Note: This does not take into account places (first, second, third, fourth). (Alpha) (Boxtrot) (Yisele, Xray), (Alpha) (Yisele) (Boxtrot, Xray), (Alpha) (Xray) (Boxtro, Yisele), (Boxtrot) (Yisele) (Alpha, Xray), (Boxtrot) (Xray) (Alpha, Yisele), (Yisele) (Xray) (Alpha, Beta)
  • 11. Bell Numbers Blocks, Partitions Arrangements and Outcomes # Blocks Partitions 1 (Alpha, Boxtrot, Yisele, Xray) Total Partitions 1 Arrangements per Partition 1! Outcomes Possible 1 2 (Alpha) (Boxtrot, Yisele, Xray) , (Boxtrot) (Alpha, Yisele, Xray), (Yisele) (Alpha, Boxtrot, Xray), (Xray) (Alpha, Boxtrot, Yisele). (Alpha, Boxtrot) (Yisele, Xray), (Alpha, Yisele) (Boxtrot, Xray), (Alpha, Xray) (Boxtrot, Yisele) 7 2! 14 3 (Alpha) (Boxtrot) (Yisele, Xray), (Alpha) (Yisele) (Boxtrot, Xray), (Alpha) (Xray) (Boxtro, Yisele), (Boxtrot) (Yisele) (Alpha, Xray), (Boxtrot) (Xray) (Alpha, Yisele), (Yisele) (Xray) (Alpha, Beta) 6 3! 36 4 (Alpha) (Boxtrot) (Yisele) (Xray) 1 15 4! 24 Bell Number The number of ways a set of n elements can be partitioned into m nonempty subsets S(n,m) is the Bell number. In this case 4 horses (elements) can be partitioned in 15 different ways. In this case we added it up manually but we can determine a formula and also a graphical way to calculate as follows….
  • 12. Bell Numbers Calculate Graphically The numbers can be constructed by using the Bell Triangle. Start with a row with the number one. Afterward each row begins with the last number of the previous row and continues to the right adding each number to the number above it to get the next number in the row..
  • 13. Bell Numbers The Formula S(n+1) = S(n,m-1) + m * S(n,m) n = elements m = blocks B(5) = S(5,1) + S(5,2) + S(5,3) + S(5,4) + S(5,5)
  • 14. Answer to the Problem H8 = Where S(n,k) denotes the # ways n horses can cross in k blocks. H8 = 1×1! + 127×2! + 966×3! + 1701×4! + 1050×5! + 266×6! + 28×7! + 1×8! = 545835. H8 denotes the number of ways 8 horses can cross the finish line.
  • 15. Bell Numbers Psuedocode How do you represent a partitioning of a set of n elements? (This example is somewhat more challenging that the previous ones. Feel free to skim it, and go on.) The n’th Bell number Bn is the number of ways of partitioning n (distinct) objects. One way of computing the Bell numbers is by using the following double recursive algorithm. This algorithm computes numbers with two arguments: B(i,j). The n’th Bell number, Bn is computed as B(n,n). For example to find B3 compute B(3,3).1 B(1,1) = 1. B(n,1) = B(n-1,n-1) for n > 1. B(i,j) = B(i-1,j-1) + B(i,j-1) for n > 1 and 1 < j # i. Technical Information: Language: Objects:
  • 16. All Pairs Shortest Path Given a weighted graph G(V,E,w), the all-pairs shortest paths problem is to find the shortest paths between all pairs of vertices vi, vj ∈ V. A number of algorithms are known for solving this problem.
  • 17. All Pairs Shortest Path Consider the multiplication of the weighted adjacency matrix with itself - except, in this case, we replace the multiplication operation in matrix multiplication by addition, and the addition operation by minimization. Notice that the product of weighted adjacency matrix with itself returns a matrix that contains shortest paths of length 2 between any pair of nodes. It follows from this argument that An contains all shortest paths. Transitive Closure : of R is the smallest transitive relation containing R.
  • 18. All Pairs Shortest Path 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 R R[i,j] = { P1 1 0 Pk [i,j] = { 1 0 If there is a path of exactly K from i-> j
  • 19. All Pairs Shortest Path 0 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 P3 P2 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 P4 P = P1 + P2+P3+P4
  • 20. All Pairs Shortest Path An is computed by doubling powers - i.e., as A, A2, A4, A8, and so on. We need log n matrix multiplications, each taking time O(n3). The serial complexity of this procedure is O(n3log n). This algorithm is not optimal, since the best known algorithms have complexity O(n3).
  • 21. All Pairs Shortest Path Parallel Formulation Each of the log n matrix multiplications can be performed in parallel. We can use n3/log n processors to compute each matrix-matrix product in time log n. The entire process takes O(log2n) time.
  • 22. All Pairs Shortest Path Parallel Formulation def adj2(i,j): if adj(i,j) == 1: return 1 else: for k in range(0,n): # where n is the number of vertices in G if adj(i,k) == 1 and adj(k,j) == 1: return 1 return 0
  • 23. Shell Sort – Example 1 Initial Segmenting Gap = 4 80 93 60 12 42 30 68 85 10 10 30 60 12 42 93 68 85 80
  • 24. Shell Sort – Example 2 Resegmenting Gap = 2 10 30 60 12 42 93 68 85 80 10 12 42 30 60 85 68 93 80
  • 25. Shell Sort – Example 3 Resegmenting Gap = 1 10 12 42 30 60 85 68 93 80 10 12 30 42 60 68 80 85 93
  • 26. Shell Sort Psuedocode # Sort an array a[0...n-1]. gaps = [701, 301, 132, 57, 23, 10, 4, 1] foreach (gap in gaps) { # Do an insertion sort for each gap size. for (i = gap; i < n; i += 1) { temp = a[i] for (j = i; j >= gap and a[j - gap] > temp; j -= gap) { a[j] = a[j - gap] } a[j] = temp } } Technical Information: Language: Programming Constructs: Efficiency:
  • 27. Radix Sort For simplicity, say you want to use the decimal radix (=10) for sorting. Then you would start by separating the numbers by units and then putting them together again; next you would separate the numbers by tens and then put them together again; then by hundreds and so on until all the numbers are sorted. Each time you loop, just read the list from left to right. You can also imagine you are separating the numbers into buckets. Here is an illustration using
  • 28. Radix Sort 5, 213, 55, 21, 2334, 31, 20, 430 Separate by units: zeros: 20, 430 ones: 21, 31 twos: threes: 213 fours: 2334 fives: 5, 55 Back together: 20, 430, 21, 31, 213, 2334, 5, 55 To put them back together, first read the zeroes bucket, then the ones bucket, then so on, until you read the nines bucket.
  • 29. Radix Sort Separate by tens: zeros: 05 ones: 213 twos: 20, 21 threes: 430, 2334, fours: fives: 55 Back together: 5, 213, 20, 21, 430, 2334, 55
  • 30. Radix Sort Separate by hundreds: zeros: 005, 020, 021, 055 ones: twos: 213 threes: 2334 fours: 430 fives: Back together: 5, 20, 21, 55, 213, 2334, 430
  • 31. Radix Sort Separate by thousands: zeros: 0005, 0020, 0021, 0055,0213, 0430 ones: twos: 2334 threes: fours: fives: Back together: 5, 20, 21, 55, 213, 430, 2334

Editor's Notes

  1. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  2. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  3. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  4. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  5. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  6. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  7. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  8. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  9. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  10. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  11. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  12. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  13. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  14. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  15. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  16. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  17. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  18. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  19. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  20. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  21. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  22. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  23. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  24. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  25. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  26. ----- Meeting Notes (6/12/13 13:05) ----- dfa
  27. ----- Meeting Notes (6/12/13 13:05) ----- dfa