SlideShare a Scribd company logo
PRESENTED TO :-
•




    Madam Huma

                      1
Presented By:-

 Muhammad Uzair Rasheed
            2009-CPE-03
     UCE&T BZU MULTAN




                      2
The Objective of Today’s Presentation

To become familiar with the concept of
algorithms:

   – What they are?
   – What is their use?
   – What do they consist of?
   – What are the techniques used for
     representing them?
   – How do we can analyze them?
                                         3
al.go.rithm
    steps
sequence
       Sequence of steps
that can be taken to solve a given problem




                                         4
Solving Problems (1)
When faced with a problem:
  1. We first clearly define the problem
  2. Think of possible solutions
  3. Select the one that we think is the best
     under the prevailing circumstances
  4. And then apply that solution
  5. If the solution woks as desired, fine; else
     we go back to step 2                     5
Solving Problems (2)
• It is quite common to first solve a problem
  for a particular case
• Then for another
• And, possibly another
• And watch for patterns and trends that
  emerge
• And to use the knowledge form those
  patterns and trends in coming up with a
  general solution                          6
Solving Problems (3)
• It helps if we have experienced that problem
  or similar ones before

• Generally, there are many ways of solving a
  given problem; the best problem-solvers
  come-up with the most appropriate solution
  more often than not!

• The process that can be used to solve a
  problem is termed as the “algorithm”      7
Examples
•   Addition
•   Conversion from decimal to binary
•   The process of boiling an egg
•   The process of mailing a letter
•   Sorting
•   Searching



                                        8
Let us write down the algorithm for
  a problem that is familiar to us

  Converting a decimal number into binary




                                            9
Convert 75 to Binary
  2     75   remainder
  2     37      1
  2     18      1
  2     9       0
  2     4       1
  2     2       0
  2     1       0
        0       1


  1001011                10
Algorithm for Decimal-to-Binary Conversion

1. Write the decimal number

2. Divide by 2; write quotient and remainder

3. Repeat step 2 on the quotient; keep on
   repeating until the quotient becomes zero

4. Write all remainder digits in the reverse order
   (last remainder first) to form the final result
                                               11
Three Requirements:
1. Sequence is:
   a. Precise
   b. Consists of a limited number of steps


2. Each step is:
   a. Unambiguous
   b. Executable


3. The sequence of steps terminates in
   the form of a solution                     12
Why Algorithms are Useful?
• Once we find an algorithm for solving a
  problem, we do not need to re-discover it the
  next time we are faced with that problem

• Once an algorithm is known, the task of
  solving the problem reduces to following
  (almost blindly and without thinking) the
  instructions precisely

• All the knowledge required for solving the
  problem is present in the algorithm        13
Why Write an Algorithm Down?
• For your own use in the future, so that you
  don’t have spend the time for rethinking it

• Written form is easier to modify and improve

• Makes it easy when explaining the process
  to others


                                            14
Analysis of Algorithms
• Analysis in the context of algorithms is concerned with
  predicting the resources that re requires:
  –   Computational time
  –   Memory
  –   Bandwidth
  –   Logic functions

• However, Time – generally measured in terms of the
  number of steps required to execute an algorithm - is
  the resource of most interest

• By analyzing several candidate algorithms, the most
  efficient one(s) can be identified              15
A Selection of Algorithmic
        Application Areas
•   Search
•   Sort
•   Cryptography
•   Numeric
•   Graphical
•   Quantum computing


                                  16
We’ll now talk about the various
ways of representing algorithms.

But, before we do that please allow
me to say a few words about …




                                      17
Syntax & Semantics
An algo. is “correct” if its: WARNINGS:
  – Semantics are correct
                              1. An algo. can be
  – Syntax is correct         syntactically correct,
                              yet semantically
Semantics:                    incorrect – very
 The concept embedded in dangerous situation!
  an algorithm (the soul!)
                             2. Syntactic
Syntax:                      correctness is easier
 The actual representation to check as
 of an algorithm (the body!) compared with 18
Now onto Algorithm Representation
• We have said enough about algorithms – their
  definition, their types, etc.

• But, how do we actually represent them?

• Generally, SW developers represent them in
  one of three forms:
  – Pseudo code
  – Flowcharts
  – Actual code                             19
HOW TO WRITE AN ALGORITHM

• Part-1:-
• NAME OF ALGORITHM(NAME OF
  VARIABLES USED)
• BRIEF DISCRIPTION ABOUT VARIABLES
  USED IN SIMPLE ENGLISH
• Part-2:-
• Series of steps to solve a problem


                                       20
OPERATIONS THAT CAN BE PERFORMED

• TRAVERSING

• INSERTION

• DELETION

• SORTING

• MERGING
                                      21
Types of sorting
• Bubble sorting.

• Selection sorting.

• Insertion sorting.

• Merge sorting.
                             22
Method of Bubble sorting
• To sort data in an array of n elements,
  n-1 iterations are required.



• There are following steps explain
  sorting of data in ascending order using
  bubble sort method:
                                            23
• In first Iteration, the largest value
  moves to the last position in the array.
• In the second iteration the above
  process is repeated and the second
  largest value moves to the second last
  position and so on.
• In n-1 iteration, the data is arranged in
  ascending order.
                                              24

More Related Content

Viewers also liked (13)

Engineer
EngineerEngineer
Engineer
Ron Liu
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
Ron Liu
 
Verilog HDL Training Course
Verilog HDL Training CourseVerilog HDL Training Course
Verilog HDL Training Course
Paul Laskowski
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
Abhiraj Bohra
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
Pantech ProLabs India Pvt Ltd
 
Verilog
VerilogVerilog
Verilog
Mr SMAK
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
Muhammad Uzair Rasheed
 
Verilog
VerilogVerilog
Verilog
Mohamed Rayan
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
Maryala Srinivas
 
Brainsense -Brain computer Interface
Brainsense -Brain computer InterfaceBrainsense -Brain computer Interface
Brainsense -Brain computer Interface
Pantech ProLabs India Pvt Ltd
 
Wavelength division multiplexing
Wavelength division multiplexingWavelength division multiplexing
Wavelength division multiplexing
Muhammad Uzair Rasheed
 
Tdm & fdm
Tdm & fdmTdm & fdm
Tdm & fdm
Muhammad Uzair Rasheed
 
Getting started with image processing using Matlab
Getting started with image processing using MatlabGetting started with image processing using Matlab
Getting started with image processing using Matlab
Pantech ProLabs India Pvt Ltd
 

Similar to Algorithms 1 (20)

Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
ShaistaRiaz4
 
Introduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer ScienceIntroduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer Science
tissandavid
 
introduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer scienceintroduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer science
tissandavid
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Binary to hexadecimal algorithmic old.pptx
Binary to hexadecimal algorithmic old.pptxBinary to hexadecimal algorithmic old.pptx
Binary to hexadecimal algorithmic old.pptx
bulbul931579
 
CPP12 - Algorithms
CPP12 - AlgorithmsCPP12 - Algorithms
CPP12 - Algorithms
Michael Heron
 
Chp-1 DAA (2).pptx design analysis and algoritham presentation
Chp-1 DAA (2).pptx design analysis and algoritham presentationChp-1 DAA (2).pptx design analysis and algoritham presentation
Chp-1 DAA (2).pptx design analysis and algoritham presentation
vaishnavbhavna17
 
Algorithm and C code related to data structure
Algorithm and C code related to data structureAlgorithm and C code related to data structure
Algorithm and C code related to data structure
Self-Employed
 
Object Oriented Paradigm
Object Oriented ParadigmObject Oriented Paradigm
Object Oriented Paradigm
Hüseyin Ergin
 
Programming in C - Problem Solving using C
Programming in C - Problem Solving using CProgramming in C - Problem Solving using C
Programming in C - Problem Solving using C
PoovizhiP1
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
DipayanSadhu1
 
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPTANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
AIET
 
Lecture 1 (bce-7)
Lecture   1 (bce-7)Lecture   1 (bce-7)
Lecture 1 (bce-7)
farazahmad005
 
Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo code
hamza javed
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptChapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Tekle12
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
Tekle12
 
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of Algorithms
Krishnan MuthuManickam
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture Notes
FellowBuddy.com
 
Daa
DaaDaa
Daa
Dhananjay Singh
 
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
ShaistaRiaz4
 
Introduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer ScienceIntroduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer Science
tissandavid
 
introduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer scienceintroduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer science
tissandavid
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Binary to hexadecimal algorithmic old.pptx
Binary to hexadecimal algorithmic old.pptxBinary to hexadecimal algorithmic old.pptx
Binary to hexadecimal algorithmic old.pptx
bulbul931579
 
Chp-1 DAA (2).pptx design analysis and algoritham presentation
Chp-1 DAA (2).pptx design analysis and algoritham presentationChp-1 DAA (2).pptx design analysis and algoritham presentation
Chp-1 DAA (2).pptx design analysis and algoritham presentation
vaishnavbhavna17
 
Algorithm and C code related to data structure
Algorithm and C code related to data structureAlgorithm and C code related to data structure
Algorithm and C code related to data structure
Self-Employed
 
Object Oriented Paradigm
Object Oriented ParadigmObject Oriented Paradigm
Object Oriented Paradigm
Hüseyin Ergin
 
Programming in C - Problem Solving using C
Programming in C - Problem Solving using CProgramming in C - Problem Solving using C
Programming in C - Problem Solving using C
PoovizhiP1
 
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPTANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
AIET
 
Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo code
hamza javed
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptChapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Tekle12
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
Tekle12
 
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of Algorithms
Krishnan MuthuManickam
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture Notes
FellowBuddy.com
 
Ad

More from Muhammad Uzair Rasheed (20)

Pak Energy conservation
Pak Energy conservation Pak Energy conservation
Pak Energy conservation
Muhammad Uzair Rasheed
 
Pakistan Energy Conservation
Pakistan Energy ConservationPakistan Energy Conservation
Pakistan Energy Conservation
Muhammad Uzair Rasheed
 
Molten Salt Reactor
Molten Salt ReactorMolten Salt Reactor
Molten Salt Reactor
Muhammad Uzair Rasheed
 
Sampling
SamplingSampling
Sampling
Muhammad Uzair Rasheed
 
Zindagi gulzar-hai
Zindagi gulzar-haiZindagi gulzar-hai
Zindagi gulzar-hai
Muhammad Uzair Rasheed
 
C++loop statements
C++loop statementsC++loop statements
C++loop statements
Muhammad Uzair Rasheed
 
Presentation on 2 nd generation telecommunication system
Presentation on 2 nd generation telecommunication systemPresentation on 2 nd generation telecommunication system
Presentation on 2 nd generation telecommunication system
Muhammad Uzair Rasheed
 
Transmission media
Transmission mediaTransmission media
Transmission media
Muhammad Uzair Rasheed
 
Guided media
Guided mediaGuided media
Guided media
Muhammad Uzair Rasheed
 
Phase shift
Phase shiftPhase shift
Phase shift
Muhammad Uzair Rasheed
 
Gsm – global system for mobile communication
Gsm – global system for mobile communicationGsm – global system for mobile communication
Gsm – global system for mobile communication
Muhammad Uzair Rasheed
 
First generation network
First generation networkFirst generation network
First generation network
Muhammad Uzair Rasheed
 
First and second generation communication
First and second generation communicationFirst and second generation communication
First and second generation communication
Muhammad Uzair Rasheed
 
Fdm
FdmFdm
Fdm
Muhammad Uzair Rasheed
 
Channel impairments
Channel impairmentsChannel impairments
Channel impairments
Muhammad Uzair Rasheed
 
Angle modulation
Angle modulationAngle modulation
Angle modulation
Muhammad Uzair Rasheed
 
Analog to-digital conversion
Analog to-digital conversionAnalog to-digital conversion
Analog to-digital conversion
Muhammad Uzair Rasheed
 
Amplitude modulation
Amplitude modulationAmplitude modulation
Amplitude modulation
Muhammad Uzair Rasheed
 
Computer viruses
Computer virusesComputer viruses
Computer viruses
Muhammad Uzair Rasheed
 
Boolean algebra
 Boolean algebra Boolean algebra
Boolean algebra
Muhammad Uzair Rasheed
 
Ad

Recently uploaded (20)

How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..
faizanaltaf231
 
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATIONTHE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
PROF. PAUL ALLIEU KAMARA
 
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT PatnaSwachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Quiz Club, Indian Institute of Technology, Patna
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
LDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-inLDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-in
LDM & Mia eStudios
 
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
SweetytamannaMohapat
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in IndiaSmart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
Dashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo SlidesDashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo Slides
Celine George
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptxAnalysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Search Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website SuccessSearch Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website Success
Muneeb Rana
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRMHow to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..
faizanaltaf231
 
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATIONTHE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
PROF. PAUL ALLIEU KAMARA
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
LDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-inLDMMIA Bonus GUEST GRAD Student Check-in
LDMMIA Bonus GUEST GRAD Student Check-in
LDM & Mia eStudios
 
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
SweetytamannaMohapat
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in IndiaSmart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
Dashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo SlidesDashboard Overview in Odoo 18 - Odoo Slides
Dashboard Overview in Odoo 18 - Odoo Slides
Celine George
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptxAnalysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Search Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website SuccessSearch Engine Optimization (SEO) for Website Success
Search Engine Optimization (SEO) for Website Success
Muneeb Rana
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
How to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRMHow to Create a Stage or a Pipeline in Odoo 18 CRM
How to Create a Stage or a Pipeline in Odoo 18 CRM
Celine George
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptxSEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
SEXUALITY , UNWANTED PREGANCY AND SEXUAL ASSAULT .pptx
PoojaSen20
 

Algorithms 1

  • 1. PRESENTED TO :- • Madam Huma 1
  • 2. Presented By:- Muhammad Uzair Rasheed 2009-CPE-03 UCE&T BZU MULTAN 2
  • 3. The Objective of Today’s Presentation To become familiar with the concept of algorithms: – What they are? – What is their use? – What do they consist of? – What are the techniques used for representing them? – How do we can analyze them? 3
  • 4. al.go.rithm steps sequence Sequence of steps that can be taken to solve a given problem 4
  • 5. Solving Problems (1) When faced with a problem: 1. We first clearly define the problem 2. Think of possible solutions 3. Select the one that we think is the best under the prevailing circumstances 4. And then apply that solution 5. If the solution woks as desired, fine; else we go back to step 2 5
  • 6. Solving Problems (2) • It is quite common to first solve a problem for a particular case • Then for another • And, possibly another • And watch for patterns and trends that emerge • And to use the knowledge form those patterns and trends in coming up with a general solution 6
  • 7. Solving Problems (3) • It helps if we have experienced that problem or similar ones before • Generally, there are many ways of solving a given problem; the best problem-solvers come-up with the most appropriate solution more often than not! • The process that can be used to solve a problem is termed as the “algorithm” 7
  • 8. Examples • Addition • Conversion from decimal to binary • The process of boiling an egg • The process of mailing a letter • Sorting • Searching 8
  • 9. Let us write down the algorithm for a problem that is familiar to us Converting a decimal number into binary 9
  • 10. Convert 75 to Binary 2 75 remainder 2 37 1 2 18 1 2 9 0 2 4 1 2 2 0 2 1 0 0 1 1001011 10
  • 11. Algorithm for Decimal-to-Binary Conversion 1. Write the decimal number 2. Divide by 2; write quotient and remainder 3. Repeat step 2 on the quotient; keep on repeating until the quotient becomes zero 4. Write all remainder digits in the reverse order (last remainder first) to form the final result 11
  • 12. Three Requirements: 1. Sequence is: a. Precise b. Consists of a limited number of steps 2. Each step is: a. Unambiguous b. Executable 3. The sequence of steps terminates in the form of a solution 12
  • 13. Why Algorithms are Useful? • Once we find an algorithm for solving a problem, we do not need to re-discover it the next time we are faced with that problem • Once an algorithm is known, the task of solving the problem reduces to following (almost blindly and without thinking) the instructions precisely • All the knowledge required for solving the problem is present in the algorithm 13
  • 14. Why Write an Algorithm Down? • For your own use in the future, so that you don’t have spend the time for rethinking it • Written form is easier to modify and improve • Makes it easy when explaining the process to others 14
  • 15. Analysis of Algorithms • Analysis in the context of algorithms is concerned with predicting the resources that re requires: – Computational time – Memory – Bandwidth – Logic functions • However, Time – generally measured in terms of the number of steps required to execute an algorithm - is the resource of most interest • By analyzing several candidate algorithms, the most efficient one(s) can be identified 15
  • 16. A Selection of Algorithmic Application Areas • Search • Sort • Cryptography • Numeric • Graphical • Quantum computing 16
  • 17. We’ll now talk about the various ways of representing algorithms. But, before we do that please allow me to say a few words about … 17
  • 18. Syntax & Semantics An algo. is “correct” if its: WARNINGS: – Semantics are correct 1. An algo. can be – Syntax is correct syntactically correct, yet semantically Semantics: incorrect – very The concept embedded in dangerous situation! an algorithm (the soul!) 2. Syntactic Syntax: correctness is easier The actual representation to check as of an algorithm (the body!) compared with 18
  • 19. Now onto Algorithm Representation • We have said enough about algorithms – their definition, their types, etc. • But, how do we actually represent them? • Generally, SW developers represent them in one of three forms: – Pseudo code – Flowcharts – Actual code 19
  • 20. HOW TO WRITE AN ALGORITHM • Part-1:- • NAME OF ALGORITHM(NAME OF VARIABLES USED) • BRIEF DISCRIPTION ABOUT VARIABLES USED IN SIMPLE ENGLISH • Part-2:- • Series of steps to solve a problem 20
  • 21. OPERATIONS THAT CAN BE PERFORMED • TRAVERSING • INSERTION • DELETION • SORTING • MERGING 21
  • 22. Types of sorting • Bubble sorting. • Selection sorting. • Insertion sorting. • Merge sorting. 22
  • 23. Method of Bubble sorting • To sort data in an array of n elements, n-1 iterations are required. • There are following steps explain sorting of data in ascending order using bubble sort method: 23
  • 24. • In first Iteration, the largest value moves to the last position in the array. • In the second iteration the above process is repeated and the second largest value moves to the second last position and so on. • In n-1 iteration, the data is arranged in ascending order. 24