SlideShare a Scribd company logo
1 of 27
Download to read offline
Biological Sciences faculty
Biophysics Department
Bioinformatics Algorithms Present
Presented By
Alireza Doustmohammadi
Graduate Student in Bioinformatics
December 2018
BA Present Tarbiat Modares University 1 of 27
Contents
Introduction
Donald Knuth
LCA Time Complexity
2 of 27BA Present Tarbiat Modares University
Introduction
3 of 27
LCP Problem:
longest common prefix of two suffixes
BA Present Tarbiat Modares University
Suffix i Suffix j
History
Donald Knuth
[https://alchetron.com/Donald-Knuth]
4 of 27
 An American computer scientist, mathematician
 Popularized the asymptotic notation
[http://tcs.unige.ch/doku.php]
BA Present Tarbiat Modares University
LCA
Most Popular Activities
Donald Knuth
[https://www.amazon.in/Computer-
Programming-Volumes-1-4A
-Boxed/dp/0321751043]
5 of 27BA Present Tarbiat Modares University
LCA
1. The Art of Computer Programming
2. TEX Machine
Efficient LCA Algorithm
Donald Knuth
6 of 27BA Present Tarbiat Modares University
LCA
Use Euler Walking
Euler Walking
Donald Knuth
7 of 27BA Present Tarbiat Modares University
LCA
1
Euler Walking
Donald Knuth
8 of 27BA Present Tarbiat Modares University
LCA
2
1
Euler Walking
Donald Knuth
9 of 27BA Present Tarbiat Modares University
LCA
4
2
1
Euler Walking
Donald Knuth
10 of 27BA Present Tarbiat Modares University
LCA
2
4
2
1
Euler Walking
Donald Knuth
11 of 27BA Present Tarbiat Modares University
LCA
5
2
4
2
1
Euler Walking
Donald Knuth
12 of 27BA Present Tarbiat Modares University
LCA
2
5
2
4
2
1
Euler Walking
Donald Knuth
13 of 27BA Present Tarbiat Modares University
LCA
6
2
5
2
4
2
1
Euler Walking
Donald Knuth
14 of 27BA Present Tarbiat Modares University
LCA
2
6
2
5
2
4
2
1
Euler Walking
Donald Knuth
15 of 27BA Present Tarbiat Modares University
LCA
3
1
2
6
2
5
2
4
2
1
Euler Walking
Donald Knuth
16 of 27BA Present Tarbiat Modares University
LCA
7
3
1
2
6
2
5
2
4
2
1
Euler Walking
Donald Knuth
17 of 27BA Present Tarbiat Modares University
LCA
3
7
3
1
2
6
2
5
2
4
2
1
Euler Walking
Donald Knuth
18 of 27BA Present Tarbiat Modares University
LCA
8
3
7
3
1
2
6
2
5
2
4
2
1
Euler Walking
Donald Knuth
19 of 27BA Present Tarbiat Modares University
LCA
3
8
3
7
3
1
2
6
2
5
2
4
2
1
Euler Walking
Donald Knuth
20 of 27BA Present Tarbiat Modares University
LCA
1
3
8
3
7
3
1
2
6
2
5
2
4
2
1
Efficient LCA Algorithm
Donald Knuth
21 0f 27BA Present Tarbiat Modares University
[https://www.geeksforgeeks.org/lca-n-ary-tree-constant-query-o1/]
LCA
Efficient LCA Algorithm
Donald Knuth
22 of 27BA Present Tarbiat Modares University
[https://www.geeksforgeeks.org/lca-n-ary-tree-constant-query-o1/]
RMQ
LCA
Min depth in this range
Efficient RMQ Algorithm (Sparse table)
Donald Knuth
23 of 27BA Present Tarbiat Modares University
LCA
1 2 4 2 5 2 6 2 1 3 7 3 8 3 1
0 1 2 1 2 1 2 1 0 1 2 1 2 1 0
Size of window
Efficient RMQ Algorithm (Sparse table)
Donald Knuth
24 of 27BA Present Tarbiat Modares University
LCA
1 2 4 2 5 2 6 2 1 3 7 3 8 3 1
0 1 2 1 2 1 2 1 0 1 2 1 2 1 0
0 1 1 1 1 1 1 0 0 1 1 1 1 0 -
0 1 1 1 1 1 0 0 0 0 1 1 0 - -
0 0 0 0 0 0 0 0 - - - - - - -
0 - - - - - - - - - - - - - -
s[i][j]=Min(s[i-1][j],S[i-1][j+1])
Size of window
Efficient RMQ Algorithm (Sparse table)
Donald Knuth
25 of 27BA Present Tarbiat Modares University
LCA
6 2 1 3 7
Result is min between this windows
Efficient RMQ Algorithm (Sparse table)
Donald Knuth
26 of 27BA Present Tarbiat Modares University
LCA
1 2 4 2 5 2 6 2 1 3 7 3 8 3 1
0 1 2 1 2 1 2 1 0 1 2 1 2 1 0
0 1 1 1 1 1 1 0 0 1 1 1 1 0 -
0 1 1 1 1 1 0 0 0 0 1 1 0 - -
0 0 0 0 0 0 0 0 - - - - - - -
0 - - - - - - - - - - - - - -
Size of window
Calculate Time Complexity
Donald Knuth
27 of 27BA Present Tarbiat Modares University
LCA

More Related Content

Similar to Lowest common ancestor (LCA) algorithm

Information technology syllabus
Information technology syllabusInformation technology syllabus
Information technology syllabus
Mustapher Matias
 

Similar to Lowest common ancestor (LCA) algorithm (20)

What is Multiplexer? Two Channels Multiplexer
What is Multiplexer? Two Channels Multiplexer What is Multiplexer? Two Channels Multiplexer
What is Multiplexer? Two Channels Multiplexer
 
Optimisation of Recycled Thermoplastic Plate (Tile)
Optimisation of Recycled Thermoplastic Plate (Tile)Optimisation of Recycled Thermoplastic Plate (Tile)
Optimisation of Recycled Thermoplastic Plate (Tile)
 
Design of multi objective cellular manufacturing
Design of multi  objective cellular manufacturingDesign of multi  objective cellular manufacturing
Design of multi objective cellular manufacturing
 
Simulation presentation
Simulation presentationSimulation presentation
Simulation presentation
 
C10ComputerEngg.pptx
C10ComputerEngg.pptxC10ComputerEngg.pptx
C10ComputerEngg.pptx
 
Real time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlabReal time multimedia-signal_proccesing_using_matlab
Real time multimedia-signal_proccesing_using_matlab
 
Distributed Streams
Distributed StreamsDistributed Streams
Distributed Streams
 
Bender’s Decomposition Method for a Large Two-stage Linear Programming Model
Bender’s Decomposition Method for a Large Two-stage Linear Programming ModelBender’s Decomposition Method for a Large Two-stage Linear Programming Model
Bender’s Decomposition Method for a Large Two-stage Linear Programming Model
 
An introduction to knitr and R Markdown
An introduction to knitr and R MarkdownAn introduction to knitr and R Markdown
An introduction to knitr and R Markdown
 
Summarization of online conversations
Summarization of online conversationsSummarization of online conversations
Summarization of online conversations
 
3 Introduction To Linear Programming
3 Introduction To Linear Programming3 Introduction To Linear Programming
3 Introduction To Linear Programming
 
Dynamic Data Center concept
Dynamic Data Center concept  Dynamic Data Center concept
Dynamic Data Center concept
 
Network Analysis with networkX : Real-World Example-1
Network Analysis with networkX : Real-World Example-1Network Analysis with networkX : Real-World Example-1
Network Analysis with networkX : Real-World Example-1
 
DSD-INT 2023 Deltares Hydrology Suite - An introduction - Slootjes
DSD-INT 2023 Deltares Hydrology Suite - An introduction - SlootjesDSD-INT 2023 Deltares Hydrology Suite - An introduction - Slootjes
DSD-INT 2023 Deltares Hydrology Suite - An introduction - Slootjes
 
01. Introduction.pptx
01. Introduction.pptx01. Introduction.pptx
01. Introduction.pptx
 
The Other HPC: High Productivity Computing
The Other HPC: High Productivity ComputingThe Other HPC: High Productivity Computing
The Other HPC: High Productivity Computing
 
Information technology syllabus
Information technology syllabusInformation technology syllabus
Information technology syllabus
 
[PPT] _ UNIT 2 _ Interaction-1.pptx
[PPT] _ UNIT 2 _ Interaction-1.pptx[PPT] _ UNIT 2 _ Interaction-1.pptx
[PPT] _ UNIT 2 _ Interaction-1.pptx
 
Case Studies in advanced analytics with R
Case Studies in advanced analytics with RCase Studies in advanced analytics with R
Case Studies in advanced analytics with R
 
ASSIGNMENT BOOKLET 2018 DIPLOMA IN IT 3 YEARS 1ST YEAR
ASSIGNMENT BOOKLET 2018 DIPLOMA IN IT 3 YEARS 1ST YEARASSIGNMENT BOOKLET 2018 DIPLOMA IN IT 3 YEARS 1ST YEAR
ASSIGNMENT BOOKLET 2018 DIPLOMA IN IT 3 YEARS 1ST YEAR
 

More from Alireza Doustmohammadi

More from Alireza Doustmohammadi (10)

Processing Raw scRNA-Seq Sequencing Data
Processing Raw scRNA-Seq Sequencing DataProcessing Raw scRNA-Seq Sequencing Data
Processing Raw scRNA-Seq Sequencing Data
 
Overview of Single-Cell RNA-seq
Overview of Single-Cell RNA-seqOverview of Single-Cell RNA-seq
Overview of Single-Cell RNA-seq
 
Introduction to Applied Machine Learning
Introduction to Applied Machine LearningIntroduction to Applied Machine Learning
Introduction to Applied Machine Learning
 
OSPREY 3.0: Open-Source Protein Redesign for You
OSPREY 3.0: Open-Source Protein Redesign for YouOSPREY 3.0: Open-Source Protein Redesign for You
OSPREY 3.0: Open-Source Protein Redesign for You
 
WGCNA: an R package for weighted correlation network analysis
WGCNA: an R package for weighted  correlation network analysisWGCNA: an R package for weighted  correlation network analysis
WGCNA: an R package for weighted correlation network analysis
 
Introduction to Kaa IoT platform
Introduction to Kaa IoT platformIntroduction to Kaa IoT platform
Introduction to Kaa IoT platform
 
Speech processing and the induction of spoken language
Speech processing and the induction of spoken languageSpeech processing and the induction of spoken language
Speech processing and the induction of spoken language
 
Digital data storage technologies
Digital data storage technologiesDigital data storage technologies
Digital data storage technologies
 
DevOps
DevOpsDevOps
DevOps
 
differential expression genes (DEG)
differential expression genes (DEG)differential expression genes (DEG)
differential expression genes (DEG)
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 

Recently uploaded (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

Lowest common ancestor (LCA) algorithm