SlideShare une entreprise Scribd logo
1  sur  24
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

Contenu connexe

En vedette (13)

Engineer
EngineerEngineer
Engineer
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
 
Verilog HDL Training Course
Verilog HDL Training CourseVerilog HDL Training Course
Verilog HDL Training Course
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
 
Verilog
VerilogVerilog
Verilog
 
Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
Verilog
VerilogVerilog
Verilog
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Brainsense -Brain computer Interface
Brainsense -Brain computer InterfaceBrainsense -Brain computer Interface
Brainsense -Brain computer Interface
 
Wavelength division multiplexing
Wavelength division multiplexingWavelength division multiplexing
Wavelength division multiplexing
 
Tdm & fdm
Tdm & fdmTdm & fdm
Tdm & fdm
 
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
 

Similaire à Algorithms 1

Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptxShaistaRiaz4
 
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 structureSelf-Employed
 
Object Oriented Paradigm
Object Oriented ParadigmObject Oriented Paradigm
Object Oriented ParadigmHüseyin Ergin
 
Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codehamza javed
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptTekle12
 
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.pptTekle12
 
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsKrishnan MuthuManickam
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of AlgorithmsBulbul Agrawal
 
Analysis of Algorithms
Analysis of AlgorithmsAnalysis of Algorithms
Analysis of AlgorithmsAmna Saeed
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesFellowBuddy.com
 
Machine Learning Essentials Demystified part1 | Big Data Demystified
Machine Learning Essentials Demystified part1 | Big Data DemystifiedMachine Learning Essentials Demystified part1 | Big Data Demystified
Machine Learning Essentials Demystified part1 | Big Data DemystifiedOmid Vahdaty
 
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdfLec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdfMAJDABDALLAH3
 
DynamicProgramming.pptx
DynamicProgramming.pptxDynamicProgramming.pptx
DynamicProgramming.pptxSaimaShaheen14
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxsatvikkushwaha1
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.pptALIZAIB KHAN
 

Similaire à Algorithms 1 (20)

Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
 
CPP12 - Algorithms
CPP12 - AlgorithmsCPP12 - Algorithms
CPP12 - Algorithms
 
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
 
Object Oriented Paradigm
Object Oriented ParadigmObject Oriented Paradigm
Object Oriented Paradigm
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
 
Lecture 1 (bce-7)
Lecture   1 (bce-7)Lecture   1 (bce-7)
Lecture 1 (bce-7)
 
Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo code
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
 
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
 
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of Algorithms
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
 
Analysis of Algorithms
Analysis of AlgorithmsAnalysis of Algorithms
Analysis of Algorithms
 
Daa
DaaDaa
Daa
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture Notes
 
Machine Learning Essentials Demystified part1 | Big Data Demystified
Machine Learning Essentials Demystified part1 | Big Data DemystifiedMachine Learning Essentials Demystified part1 | Big Data Demystified
Machine Learning Essentials Demystified part1 | Big Data Demystified
 
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdfLec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
Lec07-Greedy Algorithms.pdf Lec07-Greedy Algorithms.pdf
 
Lecture6 data structure(algorithms)
Lecture6 data structure(algorithms)Lecture6 data structure(algorithms)
Lecture6 data structure(algorithms)
 
DynamicProgramming.pptx
DynamicProgramming.pptxDynamicProgramming.pptx
DynamicProgramming.pptx
 
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptx
 
Types of Algorithms.ppt
Types of Algorithms.pptTypes of Algorithms.ppt
Types of Algorithms.ppt
 

Plus de Muhammad Uzair Rasheed (20)

Pak Energy conservation
Pak Energy conservation Pak Energy conservation
Pak Energy conservation
 
Pakistan Energy Conservation
Pakistan Energy ConservationPakistan Energy Conservation
Pakistan Energy Conservation
 
Molten Salt Reactor
Molten Salt ReactorMolten Salt Reactor
Molten Salt Reactor
 
Sampling
SamplingSampling
Sampling
 
Zindagi gulzar-hai
Zindagi gulzar-haiZindagi gulzar-hai
Zindagi gulzar-hai
 
C++loop statements
C++loop statementsC++loop statements
C++loop statements
 
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
 
Transmission media
Transmission mediaTransmission media
Transmission media
 
Guided media
Guided mediaGuided media
Guided media
 
Phase shift
Phase shiftPhase shift
Phase shift
 
Gsm – global system for mobile communication
Gsm – global system for mobile communicationGsm – global system for mobile communication
Gsm – global system for mobile communication
 
First generation network
First generation networkFirst generation network
First generation network
 
First and second generation communication
First and second generation communicationFirst and second generation communication
First and second generation communication
 
Fdm
FdmFdm
Fdm
 
Channel impairments
Channel impairmentsChannel impairments
Channel impairments
 
Angle modulation
Angle modulationAngle modulation
Angle modulation
 
Analog to-digital conversion
Analog to-digital conversionAnalog to-digital conversion
Analog to-digital conversion
 
Amplitude modulation
Amplitude modulationAmplitude modulation
Amplitude modulation
 
Computer viruses
Computer virusesComputer viruses
Computer viruses
 
Boolean algebra
 Boolean algebra Boolean algebra
Boolean algebra
 

Dernier

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
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.pptxDr. Sarita Anand
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
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.pptxAreebaZafar22
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 

Dernier (20)

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
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
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
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
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

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