0% found this document useful (0 votes)
3 views26 pages

LESSON 1 Intro To Data Structures and Algorithm

Uploaded by

galangjaymar1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views26 pages

LESSON 1 Intro To Data Structures and Algorithm

Uploaded by

galangjaymar1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CC-DSA 213

CC-DSA 213

LESSON 1:

Introduction to
Data Structures and
Algorithms
CC-DSA 213

Objectives:

At the end of this lesson, the students will be


able to:
• Explain the concept of Data Structures
• Classify the different types of data
structures
• Explain the properties and characteristics
of an algorithm
Before we dive in…
let’s loosen up a bit with
a quick mini game
D A T A
I N F O R MA T I ON
The Use of Data
The Use of Data

• Data represents the overall resources of


the organization.
• Data can exist in various forms, including
numbers and text on paper, bits and bytes
in computer memory, or as raw facts in a
person's mind.
• Data are aggregated and summarized in
various meaningful ways to form
information.
Data Structures
Data Structures

• A way of collecting and organizing


elements or items of data.
• An arrangement of data in a computer’s
memory in such a way that it can be
accessed quickly by the processor for the
required calculations.
• Data structure must be seen in a logical
concept that must address two
fundamental concerns.
First – how data will be stored?
- A data type is a way to classify what type of
data will be stored and used.

Second – what operations will be performed


on the data?
- Particular operations process the data in the
data structures.
Data Storage using data type int.

Operation: Display the data.


Data Structures

• The type of data structure you choose


should align with the operations you
perform most frequently.
- Fast search -> Hash table or binary search
- Insert/delete -> linked lists or queue
- Sorting -> Arrays
Data Structures

• A data structure's behavior (what it does)


should be defined independently of how it
is implemented.
• The functional definition of a data structure
is known as Abstract Data Type, which is
independent of implementation.
Algorithm

• Problem-solving is done with the help of


data structures and algorithms.
• An algorithm is a finite set of instructions or
procedures, written in order, to solve a
certain predefined task.
• In programming, algorithms are
implemented in the form of methods or
functions.
Algorithm

• Algorithm is not a program, it is the main


logic or solution to the problem, which can
be stated as pseudocode.
• Every algorithm must solve complex
problems using the following steps:
- First: Define the problem
- Second: Design the algorithm to solve the
problem
Step 1: Start from index 0

Step 2: Compare with


target

Step 3: If match, return


index
Output:

Step 4: If not found,


return -1
Step 1: Function to print an array
Step 1.1: Start from index 0
Step 1.2: Print the element
Step 1.3: Line break
Step 2: Bubble sort function
Step 2.1: Outer loop for number of passes
Step 2.2: Inner loop for comparing
adjacent elements
Step 2.3: If current element is greater
than next, swap them
Step 2.3.1: Store current value
Step 2.3.2: Move next value to
current
Step 2.3.3: Assign stored value to
next

Output:
Characteristics of a good algorithm:
1. Input and output should be well-defined
2. Each step in the algorithm should be clear
and definite
3. There should be an effective solution to a
problem
4. Should be feasible with the available
resources
5. An algorithm should have step-by-step
directions, which should be independent
of any programming code.
An algorithm is said to be effective and fast if
it takes less amount of time to perform and
consumes less memory space.
Basis of performance:
1. Time Complexity: amount of time needed
by the program to run to completion.
2. Space Complexity: amount of memory
space necessary by the algorithm, during
the course of its execution.
Classification of Data
Structure
Classification of Data Structure
Integer

Float

Primitive Data
Pointers
Structures
Data Structures

Boolean

Characters

Stacks
String

Linear Queues
Array

Non-Primitive Linked List


List
Data Structures
Trees
Records
Non-Linear
Data Structure Graph
Organization Files
Data structures are divided into two types:

1. Primitive Data Structures


- A type of data structure that cannot be
decomposed into other data structures.

2. Non-Primitive Data Structures


- A type of data structure that is
complicated and derived from one or more
primitive data structures.

You might also like