0% found this document useful (0 votes)
5 views16 pages

Data Structures & Algorithms

The document explains the concepts of computer programs, algorithms, and data structures, emphasizing their importance in automating tasks and solving problems efficiently. It defines algorithms as finite sequences of instructions and data structures as organized ways to store and manipulate data, highlighting their roles in performance and software design. The document also discusses various types of data structures, their operations, and their applications in real-world scenarios.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views16 pages

Data Structures & Algorithms

The document explains the concepts of computer programs, algorithms, and data structures, emphasizing their importance in automating tasks and solving problems efficiently. It defines algorithms as finite sequences of instructions and data structures as organized ways to store and manipulate data, highlighting their roles in performance and software design. The document also discusses various types of data structures, their operations, and their applications in real-world scenarios.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Data Structures

& Algorithms
M H B Ariyaratne
Program

A computer program is a
sequence of instructions that
will automate performing a
specific task or solve a given
problem.
Run correctly

Run efficiently

Good Be easy to read and understand


Programs
Be easy to debug

Be easy to modify
Algorithms +
Data
Structures =
Programs
Algorithm “a finite sequence of instructions, each of which has
a clear meaning and can be performed with a finite

s amount of effort in a finite length of time”


Manipulate data in data structures in various ways
Often associate with data structures.
A sequence of instructions that accomplishes a task
Algorithm in a finite period
Receives zero or more inputs
s Produces at least one output
Consists of clear and unambiguous instructions
Terminates after a finite number of steps
Precise enough to be understood by human
Algorithm Since computers are quite inflexible, in order
to be executed by a computer, need a
s programming language and need to contain
more details than algorithms
What is it supposed to do? Specification
Algorithms -
Does it really do what it is supposed to do?
Fundamental Verification

questions How efficiently does it do it? Performance analysis


What is a Data Structure?

 A data structure is a way of organising and storing data in a computer so


it can be used efficiently.
 It supports operations like insertion, searching, modification, and deletion.
 Built-in data structures include arrays, lists, stacks, queues, trees, and
graphs.
 Custom data structures are defined by programmers to model real-world
entities:
 E.g. Patient, Order, Investigation, Bill
 Combine related attributes (like name, age, lab test) and behaviours (like
calculate BMI, generate bill).
 Choosing the right data structure improves performance, maintainability,
and clarity of code.
Why Data Structures Matter

 Efficient algorithms rely on well-organised data.


 A data structure defines a specific way to arrange and store data.
 Helps perform key operations like insertion, deletion, searching, and sorting
efficiently.
 Choosing the right data structure can drastically improve performance and
scalability.
 Poor data organisation leads to slower programs and increased complexity.
 Essential in solving real-world problems using computers.
 Understanding data structures is foundational for writing reliable software.
Data Structure

 An Arrangement of Date in a computer's memory


 A particular way of organizing data in a computer so that it can be used efficiently
 A key organizing factor in software design
Data Structure Classification & Examples

 Primitive
 Character
 Integer
 Float
 Non-primitive
 Arrays
 Queue
 Lists
 Stacks
Data Structure Operations

 Insert
 Delete
 Traverse
 Search
 Sort
Problems sorted with Data
Structures & Algorithms
 Real world data storage
 Patient
 Name
 Date of Birth
 Age
 Weight
 Height
 Blood Pressure
 Programmers tools
 Not Real World Data
 For the use of the Program Itself
 Modeling
 Graphs, Plane routes,
Examples - Calculating the BMI

 Data Structures
 Float for height variable
 Float for weight variable
 Float for BMI variable
 Algorithm
 Get height
 Get weight
 Calculate BMI by weight / (height * height)
 Assign calculate value to BMI variable
 Print BMI
Thank you

You might also like