SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
VI BCA B Ms.Mary Jacob,Kristu Jayanti College
Title text
addition
Ø An algorithm can be defined as a finite set of steps, which has to be followed while carrying
out a particular problem.
Ø An algorithm is a distinct computational procedure that takes input as a set of values and
results in the output as a set of values by solving the problem. If an algorithm is correct, it
gets the correct output and terminates correctly, for each of the input instance .
Ø It can be written using a natural language such as English, Computer language or a
hardware language.
Ø Created independent of programming languages
Ø Algorithm is a finite set of instructions that if followed, accomplishes a particular task.It is a
step by step procedure for performing some task in a finite amount of time.
Definition :
A finite set of instruction that specifies a sequence of operation to be carried out in
order to solve a specific problem or class of problems is called an Algorithm.
Title text
addition
v Input : An algorithm has zero or more input quantities that are given initially before an
algorithm begins.
v Output : At least one output quantity is produced
v Definiteness: Each instruction is clear and unambiguous .It should be precisely defined.
v Finiteness : Problem must be solved in a finite number of steps and produce appropriate
results. The range of inputs for which the algorithm works perfectly should be specified.
v Effectiveness : Every instruction must be very basic so that it can be carried out, in
principle, be a person using only pencil and paper.
v Unambiguous : Algorithm should be clear and unambiguous. Each of its steps (or phases),
and their inputs/outputs should be clear and must lead to only one meaning.
Title text
addition
Ø Feasible: It must be feasible enough to produce each instruction.
Ø Flexibility: It must be flexible enough to carry out desired changes with no efforts.
Ø Efficient: The term efficiency is measured in terms of time and space required by an
algorithm to implement. Thus, an algorithm must ensure that it takes little time and
less memory space meeting the acceptable limit of development time.
Ø Independent: An algorithm must be language independent, which means that it
should mainly focus on the input and the procedure required to derive the output
instead of depending upon the language.
Title text
addition
Advantages of an Algorithm
v Effective Communication: Since it is written in a natural language like English, it
becomes easy to understand the step-by-step delineation of a solution to any
particular problem.
v Easy Debugging: A well-designed algorithm facilitates easy debugging to detect
the logical errors that occurred inside the program.
v Easy and Efficient Coding: An algorithm is nothing but a blueprint of a program
that helps develop a program.
v Independent of Programming Language: Since it is a language-independent, it
can be easily coded by incorporating any high-level language.
Title text
addition
Disadvantages of an Algorithm
Ø Developing algorithms for complex problems would be time-consuming and
difficult to understand.
Ø It is a challenging task to understand complex logic through algorithm
Title text
addition
Ø To understand the basic idea of the problem.
Ø To find an approach to solve the problem.
Ø To improve the efficiency of existing techniques.
Ø To understand the basic principles of designing the algorithms.
Title text
addition
1. How to devise algorithms?
Ø Different design strategies like backtracking , divide and conquer etc. are used to
devise new algorithms.
2. How to express algorithms?
Ø The algorithm must be expressed using a programming language so that the
computer understands the problem.
Ø Every procedure should be carefully specified with its input and output variables.
Proper documentation should also be done.
Title text
addition
3. How to validate algorithms?
Ø It is necessary to check if correct answer is obtained for all possible legal inputs.
The algorithm validation assures the algorithm to work correctly independent of the
programming language. Program proving or program verification follows .
Ø A proof of correctness requires that the solution be stated in two forms usually
annotated as a set of assertions about the input and output variables and as
predicate calculus. A proof shows that these two forms are equivalent for any legal
input.
4. How to analyze algorithms?
Ø Analysis of algorithms or performance analysis refers to the task of determining
how much computing time and storage an algorithm requires
Title text
addition
5. How to test a program?
Ø Testing is to ensure that the program works accurately and efficiently before the live
operation starts. There are two phases.
Ø 1. Debugging: It is the process of executing programs on sample data sets to
determine whether faulty results occur and if so to correct them.
Ø 2. Profiling: It is the process of executing a correct program on data sets and
measuring the time and space it takes to compute the results.
Structured Programming
Title text
addition
It is a technique for organizing and coding computer programs in which a
hierarchy of modules is used, each having a single entry and a single exit
point, and in which control is passed downward through the structure
without unconditional branches to higher levels of the structure. Three types
of control flow are used: sequential, selection and iteration.
Structured Programming- Advantages
Title text
addition
1. It is easy to write as Modular design increases the programmer's productivity by allowing
them to look at the big picture first and focus on details later. Several Programmers can work
on a single, large program, each working on a different module. Structured programs take less
time to write than standard programs.Procedures written for one program can be reused in
other programs requiring the same task.
2. It is easy to debug as each procedure is specialized to perform just one task, a procedure can
be checked individually. Older unstructured programs consist of a sequence of instructions that
are not grouped for specific tasks. The logic of such programs is cluttered with details and
therefore difficult to follow.
3. They are user friendly and easy to understand. The relationship between the procedures
shows the modular design of the program.Meaningful procedure names and clear
documentation identify the task performed by each module. Meaningful variable names help
the programmer identify the purpose of each variable.
Structured Programming- Advantages
Title text
addition
4. It is easy to maintain and accommodate changes as a correctly written structured program is
self-documenting, it can be easily understood by another programmer.
5. These are mainly problem oriented rather than machine based.
6. Program written in a higher level language can be translated into many machine languages
and therefore can run on any computer for which there exists an appropriate translator.
7. It is independent of machine on which it is used i.e. programs developed in high level
languages can be run on any computer.
Structured Programming- Disadvantages
Title text
addition
1.A high level language has to be translated into the machine language by translator and thus a
price in computer time is paid.
2. The object code generated by a translator might be inefficient compared to an equivalent
assembly language program.
3. Data type are proceeds in many functions in a structured program. When changes occur in
those data types, the corresponding change must be made to every location that acts on those
data types within the program. This is really a very time consuming task if the program is very
large.
4. In case of software development in which several programmers work as a team on an
application. In a structured program, each programmer is assigned to build a specific set of
functions and data types. Since different programmers handle separate functions that have
mutually shared data type. Other programmers in the team must reflect the changes in data
types done by the programmer in data type handled. Otherwise, it requires rewriting several
functions.
Control Structures used in writing algorithm
Title text
addition
1. Comments begin with //
2. Blocks are indicated with matching braces {}.Statements are delimited by ;
3. An identifier begins with a letter. The data types of the variables are not explicitly declared
4. Assignment variable := expression;
5. Logical operators – and, or a and not
6. Relational operators - < <= > >= *
Control Structures used in writing algorithm
Title text
addition
7. Loops – for, while and repeat and until
while loop :
while ( condition ) do
{
statement 1;
statement 2;
---
---
statement n;
}
Control Structures used in writing algorithm
Title text
addition
for loop :
for variable := value 1 to value 2 step n do
{
statement 1;
statement 2;
----
----
statement n;
}
Control Structures used in writing algorithm
Title text
addition
repeat…until :
repeat
statement 1;
statement 2;
----
----
statement n;
until(condition)
Control Structures used in writing algorithm
Title text
addition
8. Conditional statements
If (condition) then statement
If (condition) then statement1 else statement2
case
{
:condition 1 : statement1
---
---
:condition n : statement n
: else statement n+1
}
Control Structures used in writing algorithm
Title text
addition
9. Input and output using read and write
10. Type of procedure .Algorithm name(parameter list)
Algorithm-Introduction ,Characterestics & Control Structures.pdf

Mais conteúdo relacionado

Semelhante a Algorithm-Introduction ,Characterestics & Control Structures.pdf

Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)praveena p
 
Algorithms and flow charts
Algorithms and flow chartsAlgorithms and flow charts
Algorithms and flow chartsChinnu Edwin
 
Computer programing 111 lecture 2
Computer programing 111 lecture 2Computer programing 111 lecture 2
Computer programing 111 lecture 2ITNet
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptxDivyaKS12
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxSherinRappai1
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxSherinRappai
 
Program logic and design
Program logic and designProgram logic and design
Program logic and designChaffey College
 
Introduction to programming language (basic)
Introduction to programming language (basic)Introduction to programming language (basic)
Introduction to programming language (basic)nharsh2308
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and FlowchartsSURBHI SAROHA
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithmshccit
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementationghayour abbas
 
9. Software Implementation
9. Software Implementation9. Software Implementation
9. Software Implementationghayour abbas
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CPrabu U
 
265 ge8151 problem solving and python programming - 2 marks with answers
265   ge8151 problem solving and python programming - 2 marks with answers265   ge8151 problem solving and python programming - 2 marks with answers
265 ge8151 problem solving and python programming - 2 marks with answersvithyanila
 

Semelhante a Algorithm-Introduction ,Characterestics & Control Structures.pdf (20)

Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 
Algorithms and flow charts
Algorithms and flow chartsAlgorithms and flow charts
Algorithms and flow charts
 
Computer programing 111 lecture 2
Computer programing 111 lecture 2Computer programing 111 lecture 2
Computer programing 111 lecture 2
 
Cp 111 lecture 2
Cp 111 lecture 2Cp 111 lecture 2
Cp 111 lecture 2
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
 
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptxCOMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
COMPUTING AND PROGRAMMING FUNDAMENTAL.pptx
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
 
C++ good tutorial
C++ good tutorialC++ good tutorial
C++ good tutorial
 
Beekman5 std ppt_13
Beekman5 std ppt_13Beekman5 std ppt_13
Beekman5 std ppt_13
 
Introduction to programming language (basic)
Introduction to programming language (basic)Introduction to programming language (basic)
Introduction to programming language (basic)
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and Flowcharts
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithms
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementation
 
9. Software Implementation
9. Software Implementation9. Software Implementation
9. Software Implementation
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
 
Module 1 python.pptx
Module 1 python.pptxModule 1 python.pptx
Module 1 python.pptx
 
265 ge8151 problem solving and python programming - 2 marks with answers
265   ge8151 problem solving and python programming - 2 marks with answers265   ge8151 problem solving and python programming - 2 marks with answers
265 ge8151 problem solving and python programming - 2 marks with answers
 

Mais de MaryJacob24

Unit 1-Introduction to Data Structures-BCA.pdf
Unit 1-Introduction to Data Structures-BCA.pdfUnit 1-Introduction to Data Structures-BCA.pdf
Unit 1-Introduction to Data Structures-BCA.pdfMaryJacob24
 
Unit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdfUnit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdfMaryJacob24
 
C Operators and Control Structures.pdf
C Operators and Control Structures.pdfC Operators and Control Structures.pdf
C Operators and Control Structures.pdfMaryJacob24
 
Unit 4- Dynamic Programming.pdf
Unit 4- Dynamic Programming.pdfUnit 4- Dynamic Programming.pdf
Unit 4- Dynamic Programming.pdfMaryJacob24
 
Unit 3- Greedy Method.pptx
Unit 3- Greedy Method.pptxUnit 3- Greedy Method.pptx
Unit 3- Greedy Method.pptxMaryJacob24
 
tree traversals.pdf
tree traversals.pdftree traversals.pdf
tree traversals.pdfMaryJacob24
 
Linked List-Types.pdf
Linked List-Types.pdfLinked List-Types.pdf
Linked List-Types.pdfMaryJacob24
 
Unit 5- Cloud Applications.pdf
Unit 5- Cloud Applications.pdfUnit 5- Cloud Applications.pdf
Unit 5- Cloud Applications.pdfMaryJacob24
 
Simplification of Circuits.pdf
Simplification of Circuits.pdfSimplification of Circuits.pdf
Simplification of Circuits.pdfMaryJacob24
 
2 bit comparator, 4 1 Multiplexer, 1 4 Demultiplexer, Flip Flops and Register...
2 bit comparator, 4 1 Multiplexer, 1 4 Demultiplexer, Flip Flops and Register...2 bit comparator, 4 1 Multiplexer, 1 4 Demultiplexer, Flip Flops and Register...
2 bit comparator, 4 1 Multiplexer, 1 4 Demultiplexer, Flip Flops and Register...MaryJacob24
 
Data Structures & Recursion-Introduction.pdf
Data Structures & Recursion-Introduction.pdfData Structures & Recursion-Introduction.pdf
Data Structures & Recursion-Introduction.pdfMaryJacob24
 
Unit 3 - Greedy Method
Unit 3  - Greedy MethodUnit 3  - Greedy Method
Unit 3 - Greedy MethodMaryJacob24
 
Unit 3 greedy method
Unit 3  greedy methodUnit 3  greedy method
Unit 3 greedy methodMaryJacob24
 
Graph Traversals
Graph TraversalsGraph Traversals
Graph TraversalsMaryJacob24
 

Mais de MaryJacob24 (15)

Unit 1-Introduction to Data Structures-BCA.pdf
Unit 1-Introduction to Data Structures-BCA.pdfUnit 1-Introduction to Data Structures-BCA.pdf
Unit 1-Introduction to Data Structures-BCA.pdf
 
Unit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdfUnit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdf
 
C Operators and Control Structures.pdf
C Operators and Control Structures.pdfC Operators and Control Structures.pdf
C Operators and Control Structures.pdf
 
Unit 4- Dynamic Programming.pdf
Unit 4- Dynamic Programming.pdfUnit 4- Dynamic Programming.pdf
Unit 4- Dynamic Programming.pdf
 
Unit 3- Greedy Method.pptx
Unit 3- Greedy Method.pptxUnit 3- Greedy Method.pptx
Unit 3- Greedy Method.pptx
 
tree traversals.pdf
tree traversals.pdftree traversals.pdf
tree traversals.pdf
 
Linked List-Types.pdf
Linked List-Types.pdfLinked List-Types.pdf
Linked List-Types.pdf
 
Unit 5- Cloud Applications.pdf
Unit 5- Cloud Applications.pdfUnit 5- Cloud Applications.pdf
Unit 5- Cloud Applications.pdf
 
Simplification of Circuits.pdf
Simplification of Circuits.pdfSimplification of Circuits.pdf
Simplification of Circuits.pdf
 
2 bit comparator, 4 1 Multiplexer, 1 4 Demultiplexer, Flip Flops and Register...
2 bit comparator, 4 1 Multiplexer, 1 4 Demultiplexer, Flip Flops and Register...2 bit comparator, 4 1 Multiplexer, 1 4 Demultiplexer, Flip Flops and Register...
2 bit comparator, 4 1 Multiplexer, 1 4 Demultiplexer, Flip Flops and Register...
 
Data Structures & Recursion-Introduction.pdf
Data Structures & Recursion-Introduction.pdfData Structures & Recursion-Introduction.pdf
Data Structures & Recursion-Introduction.pdf
 
quick sort.pdf
quick sort.pdfquick sort.pdf
quick sort.pdf
 
Unit 3 - Greedy Method
Unit 3  - Greedy MethodUnit 3  - Greedy Method
Unit 3 - Greedy Method
 
Unit 3 greedy method
Unit 3  greedy methodUnit 3  greedy method
Unit 3 greedy method
 
Graph Traversals
Graph TraversalsGraph Traversals
Graph Traversals
 

Último

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 

Último (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

Algorithm-Introduction ,Characterestics & Control Structures.pdf

  • 1. VI BCA B Ms.Mary Jacob,Kristu Jayanti College
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Title text addition Ø An algorithm can be defined as a finite set of steps, which has to be followed while carrying out a particular problem. Ø An algorithm is a distinct computational procedure that takes input as a set of values and results in the output as a set of values by solving the problem. If an algorithm is correct, it gets the correct output and terminates correctly, for each of the input instance . Ø It can be written using a natural language such as English, Computer language or a hardware language. Ø Created independent of programming languages Ø Algorithm is a finite set of instructions that if followed, accomplishes a particular task.It is a step by step procedure for performing some task in a finite amount of time. Definition : A finite set of instruction that specifies a sequence of operation to be carried out in order to solve a specific problem or class of problems is called an Algorithm.
  • 7. Title text addition v Input : An algorithm has zero or more input quantities that are given initially before an algorithm begins. v Output : At least one output quantity is produced v Definiteness: Each instruction is clear and unambiguous .It should be precisely defined. v Finiteness : Problem must be solved in a finite number of steps and produce appropriate results. The range of inputs for which the algorithm works perfectly should be specified. v Effectiveness : Every instruction must be very basic so that it can be carried out, in principle, be a person using only pencil and paper. v Unambiguous : Algorithm should be clear and unambiguous. Each of its steps (or phases), and their inputs/outputs should be clear and must lead to only one meaning.
  • 8. Title text addition Ø Feasible: It must be feasible enough to produce each instruction. Ø Flexibility: It must be flexible enough to carry out desired changes with no efforts. Ø Efficient: The term efficiency is measured in terms of time and space required by an algorithm to implement. Thus, an algorithm must ensure that it takes little time and less memory space meeting the acceptable limit of development time. Ø Independent: An algorithm must be language independent, which means that it should mainly focus on the input and the procedure required to derive the output instead of depending upon the language.
  • 9. Title text addition Advantages of an Algorithm v Effective Communication: Since it is written in a natural language like English, it becomes easy to understand the step-by-step delineation of a solution to any particular problem. v Easy Debugging: A well-designed algorithm facilitates easy debugging to detect the logical errors that occurred inside the program. v Easy and Efficient Coding: An algorithm is nothing but a blueprint of a program that helps develop a program. v Independent of Programming Language: Since it is a language-independent, it can be easily coded by incorporating any high-level language.
  • 10. Title text addition Disadvantages of an Algorithm Ø Developing algorithms for complex problems would be time-consuming and difficult to understand. Ø It is a challenging task to understand complex logic through algorithm
  • 11. Title text addition Ø To understand the basic idea of the problem. Ø To find an approach to solve the problem. Ø To improve the efficiency of existing techniques. Ø To understand the basic principles of designing the algorithms.
  • 12. Title text addition 1. How to devise algorithms? Ø Different design strategies like backtracking , divide and conquer etc. are used to devise new algorithms. 2. How to express algorithms? Ø The algorithm must be expressed using a programming language so that the computer understands the problem. Ø Every procedure should be carefully specified with its input and output variables. Proper documentation should also be done.
  • 13. Title text addition 3. How to validate algorithms? Ø It is necessary to check if correct answer is obtained for all possible legal inputs. The algorithm validation assures the algorithm to work correctly independent of the programming language. Program proving or program verification follows . Ø A proof of correctness requires that the solution be stated in two forms usually annotated as a set of assertions about the input and output variables and as predicate calculus. A proof shows that these two forms are equivalent for any legal input. 4. How to analyze algorithms? Ø Analysis of algorithms or performance analysis refers to the task of determining how much computing time and storage an algorithm requires
  • 14. Title text addition 5. How to test a program? Ø Testing is to ensure that the program works accurately and efficiently before the live operation starts. There are two phases. Ø 1. Debugging: It is the process of executing programs on sample data sets to determine whether faulty results occur and if so to correct them. Ø 2. Profiling: It is the process of executing a correct program on data sets and measuring the time and space it takes to compute the results.
  • 15. Structured Programming Title text addition It is a technique for organizing and coding computer programs in which a hierarchy of modules is used, each having a single entry and a single exit point, and in which control is passed downward through the structure without unconditional branches to higher levels of the structure. Three types of control flow are used: sequential, selection and iteration.
  • 16. Structured Programming- Advantages Title text addition 1. It is easy to write as Modular design increases the programmer's productivity by allowing them to look at the big picture first and focus on details later. Several Programmers can work on a single, large program, each working on a different module. Structured programs take less time to write than standard programs.Procedures written for one program can be reused in other programs requiring the same task. 2. It is easy to debug as each procedure is specialized to perform just one task, a procedure can be checked individually. Older unstructured programs consist of a sequence of instructions that are not grouped for specific tasks. The logic of such programs is cluttered with details and therefore difficult to follow. 3. They are user friendly and easy to understand. The relationship between the procedures shows the modular design of the program.Meaningful procedure names and clear documentation identify the task performed by each module. Meaningful variable names help the programmer identify the purpose of each variable.
  • 17. Structured Programming- Advantages Title text addition 4. It is easy to maintain and accommodate changes as a correctly written structured program is self-documenting, it can be easily understood by another programmer. 5. These are mainly problem oriented rather than machine based. 6. Program written in a higher level language can be translated into many machine languages and therefore can run on any computer for which there exists an appropriate translator. 7. It is independent of machine on which it is used i.e. programs developed in high level languages can be run on any computer.
  • 18. Structured Programming- Disadvantages Title text addition 1.A high level language has to be translated into the machine language by translator and thus a price in computer time is paid. 2. The object code generated by a translator might be inefficient compared to an equivalent assembly language program. 3. Data type are proceeds in many functions in a structured program. When changes occur in those data types, the corresponding change must be made to every location that acts on those data types within the program. This is really a very time consuming task if the program is very large. 4. In case of software development in which several programmers work as a team on an application. In a structured program, each programmer is assigned to build a specific set of functions and data types. Since different programmers handle separate functions that have mutually shared data type. Other programmers in the team must reflect the changes in data types done by the programmer in data type handled. Otherwise, it requires rewriting several functions.
  • 19. Control Structures used in writing algorithm Title text addition 1. Comments begin with // 2. Blocks are indicated with matching braces {}.Statements are delimited by ; 3. An identifier begins with a letter. The data types of the variables are not explicitly declared 4. Assignment variable := expression; 5. Logical operators – and, or a and not 6. Relational operators - < <= > >= *
  • 20. Control Structures used in writing algorithm Title text addition 7. Loops – for, while and repeat and until while loop : while ( condition ) do { statement 1; statement 2; --- --- statement n; }
  • 21. Control Structures used in writing algorithm Title text addition for loop : for variable := value 1 to value 2 step n do { statement 1; statement 2; ---- ---- statement n; }
  • 22. Control Structures used in writing algorithm Title text addition repeat…until : repeat statement 1; statement 2; ---- ---- statement n; until(condition)
  • 23. Control Structures used in writing algorithm Title text addition 8. Conditional statements If (condition) then statement If (condition) then statement1 else statement2 case { :condition 1 : statement1 --- --- :condition n : statement n : else statement n+1 }
  • 24. Control Structures used in writing algorithm Title text addition 9. Input and output using read and write 10. Type of procedure .Algorithm name(parameter list)