SlideShare a Scribd company logo
1 of 54
Dr James Mountstephens
Introductions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
About The Course  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Course Delivery ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Lectures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Textbook ,[object Object],[object Object],[object Object]
Dr James Mountstephens 1: Introduction
Contents ,[object Object],[object Object],[object Object],[object Object]
What is an Algorithm? ,[object Object],[object Object],“ computer”  problem algorithm input output solution
What is an Algorithm? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What is an Algorithm? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What is an Algorithm? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example Problem: Greatest Common Divisor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example: Euclid’s Algorithm for GCD ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],m  mod  n  is  the remainder  of  m/n
Two Descriptions of Euclid’s algorithm ,[object Object],[object Object],[object Object],[object Object],[object Object],Step 1  If  n = 0, return m and stop; otherwise go to Step 2 Step 2  Divide m by n and assign the value of the remainder to r Step 3  Assign the value of n to m and the value of r to n.  Go to   Step 1. ,[object Object]
Other Algorithms for GCD ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Other Algorithms for GCD ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Other Algorithms for GCD ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],48 180 gcd = 12
Other Algorithms for GCD ,[object Object],[object Object],[object Object],[object Object]
Other Algorithms for GCD ,[object Object],[object Object],[object Object],[object Object],[object Object],Prime Factorisation Input:  Integer x   ≥  2,  Output:  List F of prime factors of  x P  ← Sieve(x) while n > 1  do   while n mod P[i] = 0 do F  ← F + P[i] x  ← x / P[i]   i   ← i + 1 Sieve of Eratosthenes Input:  Integer  x  ≥  2 Output:  List of primes less than or equal to  x for  p  ← 2 to  x  do  A [ p ] ←  p for  p  ← 2 to  x  do   if  A [ p ]    0    j  ←  p *   p while  j  ≤  x  do A [ j ]  ← 0   j  ←  j   + p ,[object Object],[object Object]
Fundamentals of Algorithmic Problem Solving ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Algorithm Design Techniques ,[object Object],[object Object],[object Object],[object Object],[object Object]
Analysing an Algorithm ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Important Problem Types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sorting Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sorting Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sorting Problems SelectionSort(A[0..n-1]) //Input: An array A[0..n-1] of orderable elements //Output: Array A[0..n-1] sorted in ascending order for i  ←  0 to n – 2 do min  ←  i for j  ←  i + 1 to n – 1 do if A[j] < A[min]  min  ←  j swap A[i] and A[min] ,[object Object]
Searching Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Searching Problems ,[object Object],[object Object],[object Object],Binary Search // Input: sorted array a_i < … < a_j and key x; m   (i+j)/2; while i < j and x != a_m do if x < a_m then j    m-1 else  i    m+1; if x = a_m then output a_m;
String Processing Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Graph Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1 2 3 4
Graph Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Combinatorial Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Combinatorial Problems ,[object Object],[object Object]
Geometric Problems ,[object Object],[object Object],[object Object],[object Object]
Numerical Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Fundamental Data Structures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Linear Data Structures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Linear Data Structures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Stacks and Queues ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Priority Queues and Heaps ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],9 6 8 5 2 3 9 6 5 8 2 3
Graphs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Complete, undirected graph Incomplete, directed graph Both graphs here are dense 1 2 3 4 1 2 3 4
Graph Representation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 Incomplete, directed graph G Adjacency Matrix for G Adjacency Linked List for G 2 3 4 4 4 1 2 3 4
Weighted Graphs ,[object Object],[object Object],6 8 5 7 9 1 2 3 4
Graph Properties -- Paths and Connectivity ,[object Object],[object Object],[object Object],[object Object],Simple Path from 4 to 3 (4,1,2,3) Path Length 3 Path from 4 to 3 (4,1,2,5,4,1,2,3) Path Length 7 1 2 4 5 3 1 2 4 5 3
Graph Properties -- Paths and Connectivity ,[object Object],[object Object],[object Object],[object Object],Connected Graph G1 Non-Connected Graph G2 1 2 4 5 3 1 2 4 5 3
Graph Properties -- Acyclicity ,[object Object],[object Object],[object Object],[object Object],[object Object],Directed Acyclic Graph Cycle (1,2,5,4,1) 1 2 3 4 1 2 4 5 3
Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Free Tree Free Tree that is also a forest 1 3 2 4 5 1 3 2 4 5 6 7
Rooted Trees ,[object Object],[object Object],[object Object],Free Tree Rooted Tree with 2 levels 1 3 2 4 5 1 3 2 4 5
Rooted Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1 3 2 4 5 7 6 8 9
Rooted Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],1 3 2 4 5 7 6 8 9
Ordered Trees ,[object Object],[object Object],[object Object],[object Object],Binary Tree L R L 9 6 8 5 2 3
Ordered Trees ,[object Object],[object Object],[object Object],[object Object],6 3 9 2 5 8
Sets and Dictionaries ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Algorithm chapter 2
Algorithm chapter 2Algorithm chapter 2
Algorithm chapter 2
chidabdu
 
Design and analysis of computer algorithms
Design and analysis of computer algorithmsDesign and analysis of computer algorithms
Design and analysis of computer algorithms
Krishna Chaytaniah
 
Analysis Of Algorithms I
Analysis Of Algorithms IAnalysis Of Algorithms I
Analysis Of Algorithms I
Sri Prasanna
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
sumitbardhan
 

What's hot (20)

Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
 
Algorithm chapter 2
Algorithm chapter 2Algorithm chapter 2
Algorithm chapter 2
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
chapter 1
chapter 1chapter 1
chapter 1
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)
 
Design and analysis of computer algorithms
Design and analysis of computer algorithmsDesign and analysis of computer algorithms
Design and analysis of computer algorithms
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
 
Design and analysis of Algorithm By Dr. B. J. Mohite
Design and analysis of Algorithm By Dr. B. J. MohiteDesign and analysis of Algorithm By Dr. B. J. Mohite
Design and analysis of Algorithm By Dr. B. J. Mohite
 
Greedy method
Greedy methodGreedy method
Greedy method
 
Analysis Of Algorithms I
Analysis Of Algorithms IAnalysis Of Algorithms I
Analysis Of Algorithms I
 
Daa unit 5
Daa unit 5Daa unit 5
Daa unit 5
 
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of Algorithms
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.
 
Algorithms : Introduction and Analysis
Algorithms : Introduction and AnalysisAlgorithms : Introduction and Analysis
Algorithms : Introduction and Analysis
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
 
Fundamental computing algorithms
Fundamental computing algorithmsFundamental computing algorithms
Fundamental computing algorithms
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 

Viewers also liked

Stpatrick'sday
Stpatrick'sdayStpatrick'sday
Stpatrick'sday
ToNiKi7
 
Stpatrick'sday
Stpatrick'sdayStpatrick'sday
Stpatrick'sday
ToNiKi7
 
St patrick's day
St patrick's daySt patrick's day
St patrick's day
ToNiKi7
 
SOA Program
SOA ProgramSOA Program
SOA Program
meymane
 

Viewers also liked (7)

Stpatrick'sday
Stpatrick'sdayStpatrick'sday
Stpatrick'sday
 
Stpatrick'sday
Stpatrick'sdayStpatrick'sday
Stpatrick'sday
 
Design and Analysis of Parallel AES Encryption and Decryption Algorithm for M...
Design and Analysis of Parallel AES Encryption and Decryption Algorithm for M...Design and Analysis of Parallel AES Encryption and Decryption Algorithm for M...
Design and Analysis of Parallel AES Encryption and Decryption Algorithm for M...
 
HackSwag.me Seedhack
HackSwag.me SeedhackHackSwag.me Seedhack
HackSwag.me Seedhack
 
St patrick's day
St patrick's daySt patrick's day
St patrick's day
 
SOA Program
SOA ProgramSOA Program
SOA Program
 
M.Tech: Algorithm Analysis and Design Assignment II
M.Tech: Algorithm Analysis and Design Assignment IIM.Tech: Algorithm Analysis and Design Assignment II
M.Tech: Algorithm Analysis and Design Assignment II
 

Similar to Kk20503 1 introduction

Sienna 1 intro
Sienna 1 introSienna 1 intro
Sienna 1 intro
chidabdu
 
Algorithm chapter 1
Algorithm chapter 1Algorithm chapter 1
Algorithm chapter 1
chidabdu
 
Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1
Abdul Khan
 
Analysis of Algorithm full version 2024.pptx
Analysis of Algorithm  full version  2024.pptxAnalysis of Algorithm  full version  2024.pptx
Analysis of Algorithm full version 2024.pptx
rajesshs31r
 
Design Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptxDesign Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptx
rajesshs31r
 
01 - Introduction to Algorithms.pptx
01 - Introduction to Algorithms.pptx01 - Introduction to Algorithms.pptx
01 - Introduction to Algorithms.pptx
aimeejc
 

Similar to Kk20503 1 introduction (20)

Sienna 1 intro
Sienna 1 introSienna 1 intro
Sienna 1 intro
 
19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf
 
Algorithm chapter 1
Algorithm chapter 1Algorithm chapter 1
Algorithm chapter 1
 
Daa chapter 1
Daa chapter 1Daa chapter 1
Daa chapter 1
 
Chapter one
Chapter oneChapter one
Chapter one
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notes
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptx
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptx
 
Notion of Algorithms.pdf
Notion of Algorithms.pdfNotion of Algorithms.pdf
Notion of Algorithms.pdf
 
ADA complete notes
ADA complete notesADA complete notes
ADA complete notes
 
Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1
 
Algorithms
Algorithms Algorithms
Algorithms
 
01 - DAA - PPT.pptx
01 - DAA - PPT.pptx01 - DAA - PPT.pptx
01 - DAA - PPT.pptx
 
ANALYSIS-AND-DESIGN-OF-ALGORITHM.ppt
ANALYSIS-AND-DESIGN-OF-ALGORITHM.pptANALYSIS-AND-DESIGN-OF-ALGORITHM.ppt
ANALYSIS-AND-DESIGN-OF-ALGORITHM.ppt
 
UnitI (1).ppt
UnitI (1).pptUnitI (1).ppt
UnitI (1).ppt
 
Unit 2 algorithm
Unit   2 algorithmUnit   2 algorithm
Unit 2 algorithm
 
Analysis of Algorithm full version 2024.pptx
Analysis of Algorithm  full version  2024.pptxAnalysis of Algorithm  full version  2024.pptx
Analysis of Algorithm full version 2024.pptx
 
Design Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptxDesign Analysis of Alogorithm 1 ppt 2024.pptx
Design Analysis of Alogorithm 1 ppt 2024.pptx
 
Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1
 
01 - Introduction to Algorithms.pptx
01 - Introduction to Algorithms.pptx01 - Introduction to Algorithms.pptx
01 - Introduction to Algorithms.pptx
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Kk20503 1 introduction

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Dr James Mountstephens 1: Introduction
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.