SlideShare uma empresa Scribd logo
1 de 11
Muhammad Muzammal

E – Mail : hello_hi99@hotmail.com

    Gc University Faisalabad
Intro uc n
            d tio

• An algorithm, named after the ninth century Muslim
  scholar Abu Jafar Muhammad Ibn Musu Al-
  Khowarizmi, is defined as follows:
• An algorithm is a finite step-by-step procedure to
  achieve a required result.
• An algorithm is a sequence of computational steps
  that transform the input into the output.
• An algorithm is a sequence of operations performed
  on data that have to be organized in data structures.
Algorithmic Notations

• variable:=expression
• if condition then statements {elsif condition then statements}
  [else statements]
• case switch of {sub case: statements}
• while condition do statements
• repeat statements until condition
• for variable:=initial value [step step] to final value do statements
• proc procedure name (parameters) [returns type] statements
• procedure name (arguments)
• return expression
• read variable
• write expression
Algorithmic Notations



1.    Programming notation

2.    Specification notation
Programming notation


General purpose algorithmic notations
    Pascal, C, C++, Java
• Declarations:
int i, j = 3; double sum = 0; real x;
int a[n]               // array of n integers
int b[1:n]             # array of n integers5
double c[n,n] = ([n] ([n] 1.0))
Programming notation (2)


• Sequential statements
(look: Java)
for [quantifier1, quantifier2 , ….] {
(list of statements)
}
quantifiers:
i=0 to N i=1 to N by 2
i=0 to n-1 st i!=x    #every value except x
Programming notation (3)

• Concurrent statements
– co statement1;         #N parallel processes
// ...
// statementN;
oc
– process foo {          # a process in the ...
(list of statements)     # ... background
}
process bar [i=1 to n]   # n processes
Programming notation (4)
• Functions and Procedures
• int addone(int v) {          # an integer fnct
return (v+1);
}
• main () {                     # a “void" procedure
int n, sum;
read(n);
for [i = 1 to n]
sum = sum + addone(i);
write (“the final value is”, sum);
}
Specification notation (1)

• Specifying atomic transactions
   process_state_1           #state of computation
   <S1; … Sn;>               #list of statements
   process_state_2           #state of computation
   the execution is atomic: the other processes see
   either state_1 or state_2
• Example: x = 0; y = 10;
   < x = x+1; y = y + 1; >
   For other processes:
   either x==0 & y==10 or x==1 & y==11
Specification notation (2)

• Specification of await
   < await (B) S; >
   – B delay condition
   – S sequence of statements
• B is guaranteed to be true when execution of S
  begins
• S is guaranteed to terminate
• No internal state of S is visible to other processes
• Example: <await ( s>0 ) s = s - 1; >

Mais conteúdo relacionado

Mais procurados

Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops conceptsNilesh Dalvi
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMSkoolkampus
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxclassall
 
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12koolkampus
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and boundAbhishek Singh
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaRahulAnanda1
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked ListNinad Mankar
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First SearchKevin Jadiya
 

Mais procurados (20)

Data structure
Data structureData structure
Data structure
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Vectors in Java
Vectors in JavaVectors in Java
Vectors in Java
 
Linked list
Linked listLinked list
Linked list
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
And or graph
And or graphAnd or graph
And or graph
 
Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS
 
Deadlock dbms
Deadlock dbmsDeadlock dbms
Deadlock dbms
 
Dbms lab Manual
Dbms lab ManualDbms lab Manual
Dbms lab Manual
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptx
 
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and bound
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
 

Semelhante a Algorithmic Notations

Operating System Lab Manual
Operating System Lab ManualOperating System Lab Manual
Operating System Lab ManualBilal Mirza
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++Manzoor ALam
 
Python programming –part 3
Python programming –part 3Python programming –part 3
Python programming –part 3Megha V
 
computer programming and utilization
computer programming and utilizationcomputer programming and utilization
computer programming and utilizationJAYDEV PATEL
 
DAA-Unit1.pptx
DAA-Unit1.pptxDAA-Unit1.pptx
DAA-Unit1.pptxNishaS88
 
Verilog-Behavioral Modeling .pdf
Verilog-Behavioral Modeling .pdfVerilog-Behavioral Modeling .pdf
Verilog-Behavioral Modeling .pdfUsssshaaaMehta
 
Computational Complexity.pptx
Computational Complexity.pptxComputational Complexity.pptx
Computational Complexity.pptxEnosSalar
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysisjayavignesh86
 
07 control+structures
07 control+structures07 control+structures
07 control+structuresbaran19901990
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++msharshitha03s
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialTo Sum It Up
 

Semelhante a Algorithmic Notations (20)

Operating System Lab Manual
Operating System Lab ManualOperating System Lab Manual
Operating System Lab Manual
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
 
Python programming –part 3
Python programming –part 3Python programming –part 3
Python programming –part 3
 
Python ppt
Python pptPython ppt
Python ppt
 
computer programming and utilization
computer programming and utilizationcomputer programming and utilization
computer programming and utilization
 
DSA
DSADSA
DSA
 
DAA-Unit1.pptx
DAA-Unit1.pptxDAA-Unit1.pptx
DAA-Unit1.pptx
 
Verilog-Behavioral Modeling .pdf
Verilog-Behavioral Modeling .pdfVerilog-Behavioral Modeling .pdf
Verilog-Behavioral Modeling .pdf
 
C fundamental
C fundamentalC fundamental
C fundamental
 
Computational Complexity.pptx
Computational Complexity.pptxComputational Complexity.pptx
Computational Complexity.pptx
 
3 Function & Storage Class.pptx
3 Function & Storage Class.pptx3 Function & Storage Class.pptx
3 Function & Storage Class.pptx
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysis
 
07 control+structures
07 control+structures07 control+structures
07 control+structures
 
Oop lec 1
Oop lec 1Oop lec 1
Oop lec 1
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study material
 
85ec7 session2 c++
85ec7 session2 c++85ec7 session2 c++
85ec7 session2 c++
 
Mbd2
Mbd2Mbd2
Mbd2
 
Operators
OperatorsOperators
Operators
 
Java introduction
Java introductionJava introduction
Java introduction
 

Último

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
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
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
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
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
 

Último (20)

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...
 
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
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
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...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
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
 

Algorithmic Notations

  • 1.
  • 2. Muhammad Muzammal E – Mail : hello_hi99@hotmail.com Gc University Faisalabad
  • 3. Intro uc n d tio • An algorithm, named after the ninth century Muslim scholar Abu Jafar Muhammad Ibn Musu Al- Khowarizmi, is defined as follows: • An algorithm is a finite step-by-step procedure to achieve a required result. • An algorithm is a sequence of computational steps that transform the input into the output. • An algorithm is a sequence of operations performed on data that have to be organized in data structures.
  • 4. Algorithmic Notations • variable:=expression • if condition then statements {elsif condition then statements} [else statements] • case switch of {sub case: statements} • while condition do statements • repeat statements until condition • for variable:=initial value [step step] to final value do statements • proc procedure name (parameters) [returns type] statements • procedure name (arguments) • return expression • read variable • write expression
  • 5. Algorithmic Notations 1. Programming notation 2. Specification notation
  • 6. Programming notation General purpose algorithmic notations Pascal, C, C++, Java • Declarations: int i, j = 3; double sum = 0; real x; int a[n] // array of n integers int b[1:n] # array of n integers5 double c[n,n] = ([n] ([n] 1.0))
  • 7. Programming notation (2) • Sequential statements (look: Java) for [quantifier1, quantifier2 , ….] { (list of statements) } quantifiers: i=0 to N i=1 to N by 2 i=0 to n-1 st i!=x #every value except x
  • 8. Programming notation (3) • Concurrent statements – co statement1; #N parallel processes // ... // statementN; oc – process foo { # a process in the ... (list of statements) # ... background } process bar [i=1 to n] # n processes
  • 9. Programming notation (4) • Functions and Procedures • int addone(int v) { # an integer fnct return (v+1); } • main () { # a “void" procedure int n, sum; read(n); for [i = 1 to n] sum = sum + addone(i); write (“the final value is”, sum); }
  • 10. Specification notation (1) • Specifying atomic transactions process_state_1 #state of computation <S1; … Sn;> #list of statements process_state_2 #state of computation the execution is atomic: the other processes see either state_1 or state_2 • Example: x = 0; y = 10; < x = x+1; y = y + 1; > For other processes: either x==0 & y==10 or x==1 & y==11
  • 11. Specification notation (2) • Specification of await < await (B) S; > – B delay condition – S sequence of statements • B is guaranteed to be true when execution of S begins • S is guaranteed to terminate • No internal state of S is visible to other processes • Example: <await ( s>0 ) s = s - 1; >