SlideShare a Scribd company logo
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; >

More Related Content

What's hot

Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
prachi mewara
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
sai tarlekar
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
GirdharRatne
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
Protap Mondal
 
Queue ppt
Queue pptQueue ppt
Queue ppt
SouravKumar328
 
Regular Grammar
Regular GrammarRegular Grammar
Regular Grammar
Ruchika Sinha
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked List
Reazul Islam
 
Linked list
Linked listLinked list
Linked list
Trupti Agrawal
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
Archie Jamwal
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Vraj Patel
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
Himanshu Kesharwani
 
Data structures using c
Data structures using cData structures using c
Data structures using c
Prof. Dr. K. Adisesha
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
Arrays
ArraysArrays
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
karthikeyanC40
 
Operators in java
Operators in javaOperators in java
Operators in java
Then Murugeshwari
 
Sorting
SortingSorting
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
parmeet834
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
Mohammed Sikander
 
Hash table in data structure and algorithm
Hash table in data structure and algorithmHash table in data structure and algorithm
Hash table in data structure and algorithm
Aamir Sohail
 

What's hot (20)

Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
Regular Grammar
Regular GrammarRegular Grammar
Regular Grammar
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked List
 
Linked list
Linked listLinked list
Linked list
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Arrays
ArraysArrays
Arrays
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Sorting
SortingSorting
Sorting
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Hash table in data structure and algorithm
Hash table in data structure and algorithmHash table in data structure and algorithm
Hash table in data structure and algorithm
 

Similar to Algorithmic Notations

Operating System Lab Manual
Operating System Lab ManualOperating System Lab Manual
Operating System Lab Manual
Bilal 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 3
Megha V
 
Python ppt
Python pptPython ppt
computer programming and utilization
computer programming and utilizationcomputer programming and utilization
computer programming and utilization
JAYDEV PATEL
 
DSA
DSADSA
DSA
rrupa2
 
DAA-Unit1.pptx
DAA-Unit1.pptxDAA-Unit1.pptx
DAA-Unit1.pptx
NishaS88
 
Verilog-Behavioral Modeling .pdf
Verilog-Behavioral Modeling .pdfVerilog-Behavioral Modeling .pdf
Verilog-Behavioral Modeling .pdf
UsssshaaaMehta
 
Computational Complexity.pptx
Computational Complexity.pptxComputational Complexity.pptx
Computational Complexity.pptx
EnosSalar
 
3 Function & Storage Class.pptx
3 Function & Storage Class.pptx3 Function & Storage Class.pptx
3 Function & Storage Class.pptx
aarockiaabinsAPIICSE
 
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
jayavignesh86
 
07 control+structures
07 control+structures07 control+structures
07 control+structures
baran19901990
 
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 material
To Sum It Up
 
Mbd2
Mbd2Mbd2
Operators
OperatorsOperators
Java introduction
Java introductionJava introduction
Java introduction
Samsung Electronics Egypt
 

Similar to 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
 

Recently uploaded

Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 

Recently uploaded (20)

Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 

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; >