SlideShare a Scribd company logo
CE-128T COMPUTING FUNDAMENTALS
ALGORITHMS
Computer Programming
What is Computer Programming?
Computer programming is a way of giving computers instructions about
what they should do next. These instructions are known as code, and
computer programmers write code to solve problems or perform a task.
ALGORITHM
S
WHAT IS AN ALGORITHM?
• An algorithm is a set of instructions designed to perform a specific
task.
• An algorithm is a step by step procedure to solve logical and
mathematical problems.
• A recipe is a good example of an algorithm because it says what must be
done, step by step. It takes inputs (ingredients) and produces an output
(the completed dish).
WHAT IS AN ALGORITHM?
ALGORITHM
S
WHAT IS AN ALGORITHM?
• Example: Given 𝑚 ≥ 1 and two positive numbers each containing 𝑚
digits, 𝑎𝑚−1𝑎𝑚−2 ⋯ 𝑎0 and 𝑏𝑚−1𝑏𝑚−2 ⋯ 𝑏0, add the two numbers.
ALGORITHMS WHAT IS AN ALGORITHM?
ENGR. ARIFA QAZI CS1210 – INTRODUCTION TO COMPUTING 4
Step 1: Set the value of 𝑐𝑎𝑟𝑟𝑦 to 0
Step 2: Set the value of 𝑖 to 0
Step 3: While the value of 𝑖 is less than or equal to 𝑚 − 1, repeat the instructions
in Steps 4 through 6
Step 4: Add the two digits 𝑎𝑖 and 𝑏𝑖 to the current value of 𝑐𝑎𝑟𝑟𝑦 to get 𝑐𝑖
Step 5: If 𝑐𝑖 ≥ 10, then reset 𝑐𝑗 to (𝑐𝑗 − 10) and reset the value of 𝑐𝑎𝑟𝑟𝑦 to 1;
otherwise, set the new value of 𝑐𝑎𝑟𝑟𝑦 to 0
Step 6: Add 1 to 𝑖, effectively moving one column to the left
Step 7: Set 𝑐𝑚 to the value of 𝑐𝑎𝑟𝑟𝑦
Step 8: Print out the final answer, 𝑐𝑚𝑐𝑚−1𝑐𝑚−2 ⋯ 𝑐0
Step 9: Stop
GENERAL FORM OF ALGORITHMS
• Algorithms are all around us!
ALGORITHMS GENERAL FORM OF ALGORITHMS
Step 1: Do something
Step 2: Do something
Step 3: Do something
⋮ ⋮
⋮ ⋮
Step N: Stop, you’re finished.
EXAMPLE
The algorithm from the back of a shampoo bottle.
• Is this a good algorithm?
• No!
• When to stop? Ambiguity!
ALGORITHMS EXAMPLE
Step 1: Wet hair
Step 2: Lather
Step 3: Rinse
Step 4: Repeat
EXAMPLE
An improved version of the shampoo bottle algorithm.
• One possible solution.
ALGORITHMS EXAMPLE
Step 1: Wet your hair
Step 2: Lather your hair
Step 3: Rinse your hair
Step 4: Lather your hair
Step 5: Rinse your hair
Step 6: Stop, you have finished shampooing your hair.
EXAMPLE
The algorithm to make a pie.
• Is this a good algorithm?
• No!
• How to make the crust? Ambiguity! Not primitives.
• What to do after Step 4?
ALGORITHMS EXAMPLE
Step 1: Make the crust
Step 2: Make the cherry filling
Step 3: Pour the filling into the crust
Step 4: Bake at 350 F for 45 minutes
EXAMPLE
The algorithm to display the 100th prime number.
• Is this a good algorithm?
• No!
• Not doable! The list of prime numbers is unending.
ALGORITHMS EXAMPLE
Step 1: Generate a list 𝐿 of all the prime numbers: 𝐿1, 𝐿2, 𝐿3, 𝐿4, ⋯
Step 2: Sort the list 𝐿 into ascending order.
Step 3: Print the 100th element in the list, 𝐿100
Step 4: Stop
PSEUDOCODE
• English-language constructs designed to resemble statements in
programming but do not actually run on a computer.
• Pseudo – Not real, not genuine, pretended.
• Notation resembling simplified programming language.
• Not actually a programming language but pretending to be a programming
language.
• Simple, highly readable, and has virtually no grammatical rules.
• Sometimes jokingly referred to as “a programming language without the
details.”
• Informal design notation used to solely express algorithms.
ALGORITHMS PSEUDOCODE
• Natural language is in the form of paragraphs and may lead to
ambiguities.
• High-level language is code which is difficult for even programmers to
understand.
• Pseudocode offers a compromise between the two.
• Not a formal language with rigidly standard syntactic and semantic
rules and regulations.
• Benefits
• Makes it easy to visualize the algorithm.
• Allows easy translation of the algorithm into high-level language because of
closeness in resemblance to such languages.
ALGORITHMS TYPES OF OPERATIONS
CS1210 – INTRODUCTION TO COMPUTING 11
FLOWCHART
• The diagrammatic representation of an algorithm.
• A diagram that represents a workflow or process.
• A picture of the separate steps of a process in a sequential order.
• Flowcharts use rectangles, ovals, diamonds and potentially numerous
other shapes to define the type of step, along with connecting arrows
to define flow and sequence.
• Flowcharts can be used to
• Demonstrate the way code is organized.
• Visualize the execution of code within a program.
• Show the structure of a website or application.
• Understand how users navigate a website or program.
ALGORITHMS FLOWCHART
ALGORITHMS FLOWCHART
SYMBOL NAME FUNCTION
Start/End
An oval (or ellipse) represents the start and end points of a flowchart.
Start written within the shape indicates the starting point, and
End/Stop/Exit indicates the ending point of the flowchart.
Arrows
Arrows are used to represent the workflow path. They connect the
shapes in a flow chart to show the relationship between them and the
flow or sequence of the problem-solving process.
Input/
Output
A parallelogram is used to read data (input) or print data (output).
Process
A rectangle is used to show the processing that takes place in the
flowchart.
Decision
A diamond with two branches is used to show the decision-making
step in a flowchart. A Yes/No question is specified in the diamond and
the next step in the sequence is based on the answer to that question
along the arrow labeled “Yes” or “No”.
ENGR. ARIFA QAZI CS1210 – INTRODUCTION TO COMPUTING 13
• As with algorithms, the three basic operations (sequential,
conditional, and iterative) can be represented using flowcharts as
well.
ALGORITHMS FLOWCHART
ENGR. ARIFA QAZI CS1210 – INTRODUCTION TO COMPUTING 14
EXAMPLE
Find the sum of two numbers A and B
ALGORITHMS EXAMPLE
Start
↓
A = 845
↓
B = 247
SUM OF 845 AND 247 ↓
Sum = 845 + 247
↓
Sum = 1092
↓
End
EXAMPLE
Flowchart to calculate the profit and loss.
ALGORITHMS EXAMPLE
Start
↓
FINDING PROFIT
AND LOSS WHEN
COST PRICE IS
$325 AND SELLING
PRICE IS $458
CP = 325
SP = 458
↓
Is 458 > 325? → Profit = 458 - 325
↓
Profit = $133
↓
End
EXAMPLE
Portion of a flowchart
illustrating the discount applied
on movie tickets.
ALGORITHMS EXAMPLE
EXAMPLE
Portion of a flowchart for
discount applicable.
ALGORITHMS EXAMPLE
ITEMS
ORDERED
DISCOUNT
RATE (%)
0 to 10 0
11 to 24 10
25 to 50 15
51 or more 20
EXAMPLE
Flowchart to generate the
multiplication table of a number N
ALGORITHMS EXAMPLE
Start
N = 12
Count = 1
MULTIPLICATION
TABLE OF 12
12 × 1 = 12
Count = 1 + 1 = 2
12 × 2 = 24
Count = 2 + 1 = 3
⋮
Count = 9 + 1 = 10
12 × 10 = 120
Count = 10
End
Three Programming Constructs
Three Programming Constructs are:
• Sequence
• Selection
• Iteration
Three Programming Constructs
Computer Languages
• The programming language is the medium of communication
between human and computer systems. It is the set of
instructions written in a specific style (coding) to instruct the
computer to perform a specific task.
• Three types of Computer Languages
• The computer language is used to communicate with computers.
• Broadly the computer language can be classified into three
categories
• Low level orAssembly language, machine language, and
high-level language.
Computer Languages
Machine language
• Machine language or machine code is the native language directly
understood by the computer's central processing unit or CPU.
• This type of computer language is not easy to understand, as it only uses a
binary system, an element of notations containing only a series of numbers
consisting of one and zero, to produce commands.
Computer Languages
Assembly Level or Low-Level Language
• Assembly Level Language is a set of codes that can run directly on the
computer's processor.
• This type of language is most appropriate in writing operating systems
and maintaining desktop applications.
• It allows the programmer to perform several tasks like registry access,
memory management and clock cycle correspondence.
Computer Languages
High-level programming languages
• These are the machine-independent programming languages, which
are easy to write, read, edit, and understand.
• Languages like Java, .Net, Python, JavaScript, C++, C, C#, and others
(which are very popular now to develop user-end applications). These
languages come under the category of high-level programming
language.
Middle-level programming languages
Middle-level programming languages
• The programming languages which have features of Low Level as
well as High-Level programming languages known as "Middle Level"
programming language.
• C programming languages is the best example of Middle-Level
Programming languages as it has features of low level and high-level
programming languages both.
Relationship between HLP and MLP
• The High level program(HLP) is called the Source Program and the
Machine language Program translate(MLP) it into Object Program.
Compiler VS Interpreter
• A compiler takes entire program and converts it into object code which is
typically stored in a file. The object code is also refereed as binary code
and can be directly executed by the machine after linking. Examples of
compiled programming languages are C and C++.
• Interpreters convert code into machine code when the program is run.
Execute code line by line.
• An Interpreter directly executes instructions written in a programming or
scripting language without previously converting them to an object code
or machine code. Examples of interpreted languages are Perl, Python and
Matlab.
BASIS FOR COMPARISON COMPILER INTERPRETER
Input It takes an entire program at a time. It takes a single line of code or instruction
at a time.
Output It generates intermediate object code. It does not produce any intermediate object
code.
Working mechanism The compilation is done before execution. Compilation and execution take place
simultaneously.
Speed Comparatively faster Slower
Memory Memory requirement is more due to the
creation of object code.
It requires less memory as it does not
create intermediate object code.
Errors Display all errors after compilation, all at
the same time.
Displays error of each line one by one.
Error detection Difficult Easier comparatively
Pertaining Programming languages C, C++, C#, Scala, typescript uses
compiler.
PHP, Perl, Python, Ruby uses an
interpreter.

More Related Content

PPTX
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
PPTX
asic computer is an electronic device that can receive, store, process, and o...
PPTX
Basic syntax : Algorithm,Flow chart
PPT
programming language(C++) chapter-one contd.ppt
PDF
L1. Basic Programming Concepts.pdf
PDF
Algorithmic problem sloving
PPT
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
PPTX
Lec 2 -algorithms-flowchart-and-pseudocode1.pptx
MODULE1-INTRODUCTION.pptx-COMPUTER PROGRAMING
asic computer is an electronic device that can receive, store, process, and o...
Basic syntax : Algorithm,Flow chart
programming language(C++) chapter-one contd.ppt
L1. Basic Programming Concepts.pdf
Algorithmic problem sloving
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Lec 2 -algorithms-flowchart-and-pseudocode1.pptx

Similar to 02 Algorithms and flowcharts - computers.pptx (20)

PPTX
Algorithm and pseudo codes
PDF
LESSON__1-15 C-PROGRAMMING.p algorithm df
PPTX
INTRODUCTION TO C++, Chapter 1
PPT
Unit 1 psp
PPTX
Programming requirements for beginning in software engineering.pptx
PPT
3 algorithm-and-flowchart
PPTX
Introduction to computer programming
PPTX
Introduction to programming c
PPTX
Algorithms and flow charts
PPTX
Unit 1. Problem Solving with Computer
PPTX
Mcs lec2
PPT
algorithm
PDF
Algorithm.pdf
PPTX
Pseudo code.pptx
PPT
C programming for Computing Techniques
PPT
Introduction To Programming subject1.ppt
PDF
PPS Unit-1.pdf
PDF
C Programming Slides for 1st Year Engg students
PPTX
Agro informatics centre up State of Lec 6.pptx
PPTX
Algorithms - Introduction to computer programming
Algorithm and pseudo codes
LESSON__1-15 C-PROGRAMMING.p algorithm df
INTRODUCTION TO C++, Chapter 1
Unit 1 psp
Programming requirements for beginning in software engineering.pptx
3 algorithm-and-flowchart
Introduction to computer programming
Introduction to programming c
Algorithms and flow charts
Unit 1. Problem Solving with Computer
Mcs lec2
algorithm
Algorithm.pdf
Pseudo code.pptx
C programming for Computing Techniques
Introduction To Programming subject1.ppt
PPS Unit-1.pdf
C Programming Slides for 1st Year Engg students
Agro informatics centre up State of Lec 6.pptx
Algorithms - Introduction to computer programming
Ad

Recently uploaded (20)

PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Sustainable Sites - Green Building Construction
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPT
Project quality management in manufacturing
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
composite construction of structures.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
Mechanical Engineering MATERIALS Selection
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Current and future trends in Computer Vision.pptx
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Artificial Intelligence
PPTX
OOP with Java - Java Introduction (Basics)
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Sustainable Sites - Green Building Construction
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Project quality management in manufacturing
UNIT-1 - COAL BASED THERMAL POWER PLANTS
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
composite construction of structures.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Mechanical Engineering MATERIALS Selection
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Current and future trends in Computer Vision.pptx
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
bas. eng. economics group 4 presentation 1.pptx
Foundation to blockchain - A guide to Blockchain Tech
additive manufacturing of ss316l using mig welding
Artificial Intelligence
OOP with Java - Java Introduction (Basics)
Ad

02 Algorithms and flowcharts - computers.pptx

  • 2. Computer Programming What is Computer Programming? Computer programming is a way of giving computers instructions about what they should do next. These instructions are known as code, and computer programmers write code to solve problems or perform a task. ALGORITHM S WHAT IS AN ALGORITHM?
  • 3. • An algorithm is a set of instructions designed to perform a specific task. • An algorithm is a step by step procedure to solve logical and mathematical problems. • A recipe is a good example of an algorithm because it says what must be done, step by step. It takes inputs (ingredients) and produces an output (the completed dish). WHAT IS AN ALGORITHM? ALGORITHM S WHAT IS AN ALGORITHM?
  • 4. • Example: Given 𝑚 ≥ 1 and two positive numbers each containing 𝑚 digits, 𝑎𝑚−1𝑎𝑚−2 ⋯ 𝑎0 and 𝑏𝑚−1𝑏𝑚−2 ⋯ 𝑏0, add the two numbers. ALGORITHMS WHAT IS AN ALGORITHM? ENGR. ARIFA QAZI CS1210 – INTRODUCTION TO COMPUTING 4 Step 1: Set the value of 𝑐𝑎𝑟𝑟𝑦 to 0 Step 2: Set the value of 𝑖 to 0 Step 3: While the value of 𝑖 is less than or equal to 𝑚 − 1, repeat the instructions in Steps 4 through 6 Step 4: Add the two digits 𝑎𝑖 and 𝑏𝑖 to the current value of 𝑐𝑎𝑟𝑟𝑦 to get 𝑐𝑖 Step 5: If 𝑐𝑖 ≥ 10, then reset 𝑐𝑗 to (𝑐𝑗 − 10) and reset the value of 𝑐𝑎𝑟𝑟𝑦 to 1; otherwise, set the new value of 𝑐𝑎𝑟𝑟𝑦 to 0 Step 6: Add 1 to 𝑖, effectively moving one column to the left Step 7: Set 𝑐𝑚 to the value of 𝑐𝑎𝑟𝑟𝑦 Step 8: Print out the final answer, 𝑐𝑚𝑐𝑚−1𝑐𝑚−2 ⋯ 𝑐0 Step 9: Stop
  • 5. GENERAL FORM OF ALGORITHMS • Algorithms are all around us! ALGORITHMS GENERAL FORM OF ALGORITHMS Step 1: Do something Step 2: Do something Step 3: Do something ⋮ ⋮ ⋮ ⋮ Step N: Stop, you’re finished.
  • 6. EXAMPLE The algorithm from the back of a shampoo bottle. • Is this a good algorithm? • No! • When to stop? Ambiguity! ALGORITHMS EXAMPLE Step 1: Wet hair Step 2: Lather Step 3: Rinse Step 4: Repeat
  • 7. EXAMPLE An improved version of the shampoo bottle algorithm. • One possible solution. ALGORITHMS EXAMPLE Step 1: Wet your hair Step 2: Lather your hair Step 3: Rinse your hair Step 4: Lather your hair Step 5: Rinse your hair Step 6: Stop, you have finished shampooing your hair.
  • 8. EXAMPLE The algorithm to make a pie. • Is this a good algorithm? • No! • How to make the crust? Ambiguity! Not primitives. • What to do after Step 4? ALGORITHMS EXAMPLE Step 1: Make the crust Step 2: Make the cherry filling Step 3: Pour the filling into the crust Step 4: Bake at 350 F for 45 minutes
  • 9. EXAMPLE The algorithm to display the 100th prime number. • Is this a good algorithm? • No! • Not doable! The list of prime numbers is unending. ALGORITHMS EXAMPLE Step 1: Generate a list 𝐿 of all the prime numbers: 𝐿1, 𝐿2, 𝐿3, 𝐿4, ⋯ Step 2: Sort the list 𝐿 into ascending order. Step 3: Print the 100th element in the list, 𝐿100 Step 4: Stop
  • 10. PSEUDOCODE • English-language constructs designed to resemble statements in programming but do not actually run on a computer. • Pseudo – Not real, not genuine, pretended. • Notation resembling simplified programming language. • Not actually a programming language but pretending to be a programming language. • Simple, highly readable, and has virtually no grammatical rules. • Sometimes jokingly referred to as “a programming language without the details.” • Informal design notation used to solely express algorithms. ALGORITHMS PSEUDOCODE
  • 11. • Natural language is in the form of paragraphs and may lead to ambiguities. • High-level language is code which is difficult for even programmers to understand. • Pseudocode offers a compromise between the two. • Not a formal language with rigidly standard syntactic and semantic rules and regulations. • Benefits • Makes it easy to visualize the algorithm. • Allows easy translation of the algorithm into high-level language because of closeness in resemblance to such languages. ALGORITHMS TYPES OF OPERATIONS CS1210 – INTRODUCTION TO COMPUTING 11
  • 12. FLOWCHART • The diagrammatic representation of an algorithm. • A diagram that represents a workflow or process. • A picture of the separate steps of a process in a sequential order. • Flowcharts use rectangles, ovals, diamonds and potentially numerous other shapes to define the type of step, along with connecting arrows to define flow and sequence. • Flowcharts can be used to • Demonstrate the way code is organized. • Visualize the execution of code within a program. • Show the structure of a website or application. • Understand how users navigate a website or program. ALGORITHMS FLOWCHART
  • 13. ALGORITHMS FLOWCHART SYMBOL NAME FUNCTION Start/End An oval (or ellipse) represents the start and end points of a flowchart. Start written within the shape indicates the starting point, and End/Stop/Exit indicates the ending point of the flowchart. Arrows Arrows are used to represent the workflow path. They connect the shapes in a flow chart to show the relationship between them and the flow or sequence of the problem-solving process. Input/ Output A parallelogram is used to read data (input) or print data (output). Process A rectangle is used to show the processing that takes place in the flowchart. Decision A diamond with two branches is used to show the decision-making step in a flowchart. A Yes/No question is specified in the diamond and the next step in the sequence is based on the answer to that question along the arrow labeled “Yes” or “No”. ENGR. ARIFA QAZI CS1210 – INTRODUCTION TO COMPUTING 13
  • 14. • As with algorithms, the three basic operations (sequential, conditional, and iterative) can be represented using flowcharts as well. ALGORITHMS FLOWCHART ENGR. ARIFA QAZI CS1210 – INTRODUCTION TO COMPUTING 14
  • 15. EXAMPLE Find the sum of two numbers A and B ALGORITHMS EXAMPLE Start ↓ A = 845 ↓ B = 247 SUM OF 845 AND 247 ↓ Sum = 845 + 247 ↓ Sum = 1092 ↓ End
  • 16. EXAMPLE Flowchart to calculate the profit and loss. ALGORITHMS EXAMPLE Start ↓ FINDING PROFIT AND LOSS WHEN COST PRICE IS $325 AND SELLING PRICE IS $458 CP = 325 SP = 458 ↓ Is 458 > 325? → Profit = 458 - 325 ↓ Profit = $133 ↓ End
  • 17. EXAMPLE Portion of a flowchart illustrating the discount applied on movie tickets. ALGORITHMS EXAMPLE
  • 18. EXAMPLE Portion of a flowchart for discount applicable. ALGORITHMS EXAMPLE ITEMS ORDERED DISCOUNT RATE (%) 0 to 10 0 11 to 24 10 25 to 50 15 51 or more 20
  • 19. EXAMPLE Flowchart to generate the multiplication table of a number N ALGORITHMS EXAMPLE Start N = 12 Count = 1 MULTIPLICATION TABLE OF 12 12 × 1 = 12 Count = 1 + 1 = 2 12 × 2 = 24 Count = 2 + 1 = 3 ⋮ Count = 9 + 1 = 10 12 × 10 = 120 Count = 10 End
  • 20. Three Programming Constructs Three Programming Constructs are: • Sequence • Selection • Iteration
  • 22. Computer Languages • The programming language is the medium of communication between human and computer systems. It is the set of instructions written in a specific style (coding) to instruct the computer to perform a specific task. • Three types of Computer Languages • The computer language is used to communicate with computers. • Broadly the computer language can be classified into three categories • Low level orAssembly language, machine language, and high-level language.
  • 23. Computer Languages Machine language • Machine language or machine code is the native language directly understood by the computer's central processing unit or CPU. • This type of computer language is not easy to understand, as it only uses a binary system, an element of notations containing only a series of numbers consisting of one and zero, to produce commands.
  • 24. Computer Languages Assembly Level or Low-Level Language • Assembly Level Language is a set of codes that can run directly on the computer's processor. • This type of language is most appropriate in writing operating systems and maintaining desktop applications. • It allows the programmer to perform several tasks like registry access, memory management and clock cycle correspondence.
  • 25. Computer Languages High-level programming languages • These are the machine-independent programming languages, which are easy to write, read, edit, and understand. • Languages like Java, .Net, Python, JavaScript, C++, C, C#, and others (which are very popular now to develop user-end applications). These languages come under the category of high-level programming language.
  • 26. Middle-level programming languages Middle-level programming languages • The programming languages which have features of Low Level as well as High-Level programming languages known as "Middle Level" programming language. • C programming languages is the best example of Middle-Level Programming languages as it has features of low level and high-level programming languages both.
  • 27. Relationship between HLP and MLP • The High level program(HLP) is called the Source Program and the Machine language Program translate(MLP) it into Object Program.
  • 28. Compiler VS Interpreter • A compiler takes entire program and converts it into object code which is typically stored in a file. The object code is also refereed as binary code and can be directly executed by the machine after linking. Examples of compiled programming languages are C and C++. • Interpreters convert code into machine code when the program is run. Execute code line by line. • An Interpreter directly executes instructions written in a programming or scripting language without previously converting them to an object code or machine code. Examples of interpreted languages are Perl, Python and Matlab.
  • 29. BASIS FOR COMPARISON COMPILER INTERPRETER Input It takes an entire program at a time. It takes a single line of code or instruction at a time. Output It generates intermediate object code. It does not produce any intermediate object code. Working mechanism The compilation is done before execution. Compilation and execution take place simultaneously. Speed Comparatively faster Slower Memory Memory requirement is more due to the creation of object code. It requires less memory as it does not create intermediate object code. Errors Display all errors after compilation, all at the same time. Displays error of each line one by one. Error detection Difficult Easier comparatively Pertaining Programming languages C, C++, C#, Scala, typescript uses compiler. PHP, Perl, Python, Ruby uses an interpreter.