SlideShare a Scribd company logo
HANDLING DATA IN
ALGORITHMS
CONSTANTS
 IN A PROGRAM, VALUES THAT DOES NOT CHANGE UNDER A GIVEN SET OF
CONDITIONS
 Use a unique identifier
 Declared at the start of the program
Eg: CONST PI=3.14;
CONST VAT_RATE=0.2
USES OF DECLARING CONSTANTS
 In case, if the value has happened to change, only need to change in one
place.
 Easier to understand the code as instead of numbers identifiers have been
used.
VARIABLES AND DATATYPES
 WHAT IS A VARIABLE?
 A CHARACTERISTIC, QUANTITY OR NUMBER THAT INCREASES OR DECREASES
OVER TIME OR TAKES DIFFERENT VALUES IN DIFFERENT SITUATIONS.
int number=1;
Int:number
Date Type Type of data Amount of memory
Integer Whole number 2 bytes
Real A number with a decimal
part
4 bytes
Char A single character 1 byte
String Zero or more characters 1 byte per character
Boolean Either true or false 1 byte
DATATYPES AND MEMORY SIZE REQUIRED
NUMERIC DATA TYPES
DIV AND MOD
 DIV- divides the number and gives the answer as a whole number.
13 DIV 4=3
 MOD- divides the number and gives the remainder as a whole number.
13 MOD 4=1
ARRAYS
 An array is a group of data items of the same data type stored under one
identifier one after another in memory locations.
BENEFITS OF AN ARRAY
 Easier to follow the code and find bugs easily
 Data can be processed using a FOR loop
ERRORS
 Mainly there are two types of ERRORS
 Syntax errors - misspelt code
 Logic errors – even the code works, but it does not do what you want to do.
Syntax Errors
 Translators expect to have a certain format known as syntax.
 In Delphi,
VariableName : Datatype;
 In java
int variableName;
What are the possible syntax errors?
Logic Errors
 Even though the code works but we may not be able to achieve the expected
result. These are because of logic errors.
total=a-b*2
for(int i=10;i>10;i++){
print (i);
}
How can we overcome Logic Errors
TESTING
Test purpose Test data Expected
Outcome
Actual Outcome
Design and Planning stage Final stage/Testing
If there is a range specified in the code, testing should be done
between the allowed ends and as well as not allowed ends.
This is known as testing boundary data or extremes.
IDE
 What is IDE?
Handling Data in Algorithm

More Related Content

PDF
JavaProgrammingManual
PPT
Programming Fundamentals - Lecture 1.ppt
PDF
Java Lab Manual
PPTX
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
PPSX
Data types, Variables, Expressions & Arithmetic Operators in java
PDF
Control structure repetition Tito Lacbayen
PPTX
General Programming Concept
JavaProgrammingManual
Programming Fundamentals - Lecture 1.ppt
Java Lab Manual
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
Data types, Variables, Expressions & Arithmetic Operators in java
Control structure repetition Tito Lacbayen
General Programming Concept

Similar to Handling Data in Algorithm (20)

PPT
lec_4_data_structures_and_algorithm_analysis.ppt
PPT
lec_4_data_structures_and_algorithm_analysis.ppt
PPTX
c++ computer programming language datatypes ,operators,Lecture 03 04
PPT
How to Program
PPT
Fundamentals of Programming Chapter 4
PPTX
Problem Solving PPT Slides Grade 10- 11students
PPSX
Problem solving and design
PPTX
Oops concepts variables and How to handle variable in testing
PPTX
Java fundamentals
PDF
CSC111-Chap_02.pdf
PPTX
Java chapter 2
PPTX
Java Programming Course for beginners -الدسوقي
PPTX
Software fundamentals
PPTX
C++ Tutorial
PPTX
C# basics...
PPT
DAA-Introduction-Divide and Conquer Technique
PPTX
SYSTEM DEVELOPMENT
PPTX
Fundamentals of .Net Programming concepts
PPT
Programming
PPTX
Input output
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
c++ computer programming language datatypes ,operators,Lecture 03 04
How to Program
Fundamentals of Programming Chapter 4
Problem Solving PPT Slides Grade 10- 11students
Problem solving and design
Oops concepts variables and How to handle variable in testing
Java fundamentals
CSC111-Chap_02.pdf
Java chapter 2
Java Programming Course for beginners -الدسوقي
Software fundamentals
C++ Tutorial
C# basics...
DAA-Introduction-Divide and Conquer Technique
SYSTEM DEVELOPMENT
Fundamentals of .Net Programming concepts
Programming
Input output
Ad

More from Sajitha Pathirana (12)

PPSX
Basics of Java.ppsx
PPTX
Programming Languages
PPTX
PPTX
PPTX
PPTX
Pseudocode
PPTX
Communications and Networking
PPTX
PPTX
Logical Operators
PPTX
Data Representation in Computers
PPTX
Fundamentals of computer systems
PPTX
Flow Charts
Basics of Java.ppsx
Programming Languages
Pseudocode
Communications and Networking
Logical Operators
Data Representation in Computers
Fundamentals of computer systems
Flow Charts
Ad

Recently uploaded (20)

PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
ISO 45001 Occupational Health and Safety Management System
PPT
Introduction Database Management System for Course Database
PDF
medical staffing services at VALiNTRY
PPTX
Introduction to Artificial Intelligence
PDF
Nekopoi APK 2025 free lastest update
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Understanding Forklifts - TECH EHS Solution
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
System and Network Administration Chapter 2
PDF
System and Network Administraation Chapter 3
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
L1 - Introduction to python Backend.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Which alternative to Crystal Reports is best for small or large businesses.pdf
Odoo Companies in India – Driving Business Transformation.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
ISO 45001 Occupational Health and Safety Management System
Introduction Database Management System for Course Database
medical staffing services at VALiNTRY
Introduction to Artificial Intelligence
Nekopoi APK 2025 free lastest update
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
VVF-Customer-Presentation2025-Ver1.9.pptx
Understanding Forklifts - TECH EHS Solution
How Creative Agencies Leverage Project Management Software.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
System and Network Administration Chapter 2
System and Network Administraation Chapter 3
Softaken Excel to vCard Converter Software.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
L1 - Introduction to python Backend.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41

Handling Data in Algorithm

  • 2. CONSTANTS  IN A PROGRAM, VALUES THAT DOES NOT CHANGE UNDER A GIVEN SET OF CONDITIONS  Use a unique identifier  Declared at the start of the program Eg: CONST PI=3.14; CONST VAT_RATE=0.2
  • 3. USES OF DECLARING CONSTANTS  In case, if the value has happened to change, only need to change in one place.  Easier to understand the code as instead of numbers identifiers have been used.
  • 4. VARIABLES AND DATATYPES  WHAT IS A VARIABLE?  A CHARACTERISTIC, QUANTITY OR NUMBER THAT INCREASES OR DECREASES OVER TIME OR TAKES DIFFERENT VALUES IN DIFFERENT SITUATIONS. int number=1; Int:number
  • 5. Date Type Type of data Amount of memory Integer Whole number 2 bytes Real A number with a decimal part 4 bytes Char A single character 1 byte String Zero or more characters 1 byte per character Boolean Either true or false 1 byte DATATYPES AND MEMORY SIZE REQUIRED
  • 6. NUMERIC DATA TYPES DIV AND MOD  DIV- divides the number and gives the answer as a whole number. 13 DIV 4=3  MOD- divides the number and gives the remainder as a whole number. 13 MOD 4=1
  • 7. ARRAYS  An array is a group of data items of the same data type stored under one identifier one after another in memory locations.
  • 8. BENEFITS OF AN ARRAY  Easier to follow the code and find bugs easily  Data can be processed using a FOR loop
  • 9. ERRORS  Mainly there are two types of ERRORS  Syntax errors - misspelt code  Logic errors – even the code works, but it does not do what you want to do.
  • 10. Syntax Errors  Translators expect to have a certain format known as syntax.  In Delphi, VariableName : Datatype;  In java int variableName; What are the possible syntax errors?
  • 11. Logic Errors  Even though the code works but we may not be able to achieve the expected result. These are because of logic errors. total=a-b*2 for(int i=10;i>10;i++){ print (i); }
  • 12. How can we overcome Logic Errors
  • 13. TESTING Test purpose Test data Expected Outcome Actual Outcome Design and Planning stage Final stage/Testing If there is a range specified in the code, testing should be done between the allowed ends and as well as not allowed ends. This is known as testing boundary data or extremes.

Editor's Notes

  • #16: Numeric data types- slide 6