0% found this document useful (0 votes)
28 views

DataStruc Prelim1

This document outlines the topics to be covered in a course on data structures and algorithms. The course will cover algorithms, data types, data structures, analysis of algorithms, and writing algorithms. It will discuss primitive and non-primitive data types, classes, objects, interfaces, and various data structures. Students will learn how to analyze algorithms' time and space complexity and evaluate their efficiency.

Uploaded by

erikalast.acad
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)
28 views

DataStruc Prelim1

This document outlines the topics to be covered in a course on data structures and algorithms. The course will cover algorithms, data types, data structures, analysis of algorithms, and writing algorithms. It will discuss primitive and non-primitive data types, classes, objects, interfaces, and various data structures. Students will learn how to analyze algorithms' time and space complexity and evaluate their efficiency.

Uploaded by

erikalast.acad
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
You are on page 1/ 25

DATA STRUCTURES

and ALGORITHMS

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Topic Coverage:
Topic Coverage:
• Algorithms: Definition
• Importance of an algorithm
• Variables and Data Types
• Data Structure: Definition
• Abstract Data Types
• Analysis of Algorithms
• Running Time Analysis
• Rates of Growth
• Types of Analysis

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Algorithms : Definition
Algorithms: Definition
It is a step-by-step
unambiguous
instructions to solve a
given problem.
Criteria for Judging
Algorithms:
• Correctness
• Efficiency

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Importance of Algorithms
Importance of Algorithms

It is fundamental to
computational
thinking and
problem-solving in
many facets of life.

Algorithmic Thinking
A derivative of computer science and the process to
develop code and program applications.

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Variables and Data Types
Variables and Data Types

Variables Data Types

It is a value / placeholder that A category of data stored in


can change, depending on variables.
conditions or on information
passed to the program Primitive and Non-primitive

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Primitive Data Types
Primitive Data Types

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Non-Primitive Data Types
Non-Primitive Data Types

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Non-Primitive Data Type: String
Non-Primitive Data Type: String

String is used to
store sequence of
characters (text).

String values must be


surrounded by
double quotes.

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Non-Primitive DT: Classes & Objects
Non-Primitive DT: Classes & Objects
Class is a template used Object is a member
to create objects and to (instance) of a Java
define object data types class. It has an identity,
and methods. a behavior and a state.

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Non-Primitive DT: Interface
Non-Primitive DT: Interface
Interface is a blueprint of a class. It is a mechanism to
achieve abstraction and multiple inheritance in Java.

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Primitive vs Non-Primitive
Primitive vs Non-Primitive

Primitive Non-Primitive
Created by the
Predefined (already
programmer and is not
defined)
defined
Can be used to call
It cannot call methods. methods to perform
certain operations
It has always a value. It can be null.
starts with an uppercase
Starts with lowercase letter
letter

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Data Structure
Data Structure
• It is a way of storing data when
programming
• It is not just a collection of values and
storage format but the relationship of the
values in the collection

Three Common Problems of Applications Today:


• Data Search
• Processor Speed
• Multiple Requests

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Data Structure & Algorithms
Data Structure & Algorithms
Categories of Algorithm Execution Time Cases
•Search •Update •Worst Case
•Sort •Delete •Average Case
•Insert •Best Case

Data Structure Algorithm:


Characteristics Characteristics
•Correctness •Unambiguous
•Finiteness
•Time Complexity •Input
•Feasibility
•Space Complexity •Output
•Independent

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Writing an Algorithm
Writing an Algorithm

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Algorithm Analysis
Algorithm Analysis
Sample 1 Sample 3

Sample 2

Sample 4

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Algorithm Analysis
Algorithm Analysis

Priori Analysis Efficiency is measured by


assuming that all other
Theoretical analysis factors have no effect on
of an algorithm. the implementation

Posteriori Analysis
Actual statistics like running
Empirical analysis of time and space required
are collected.
an algorithm

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Algorithm Complexity
Algorithm Complexity

Time Factor Space Factor


The number of key Counting the
operations in the maximum memory
algorithm. space required by
the algorithm.

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Time Complexity
T(n): Time Complexity

It is a numerical function T(n) that can be


measured as the number of steps, provided
each step consumes constant time.

T(n) = c ∗ n
Time taken Number of
to execute steps
task

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Space Complexity and its Components
S(P): Space Complexity - Components

S(P) = C + SP(I)
Fixed Part Variable Part
Space required to Space required by
store certain data variable whose size
and variables. depends on the size
(C) of the problem.
S(I)

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Space Complexity: Example
Space Complexity: Example

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Asymptotic Analysis
Asymptotic Analysis

It refers to defining the mathematical


foundation / framing of its run-time
performance.

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Big Oh Notation O(n)
Big Oh Notation O(n)

It measures the worst case time


complexity or the longest amount of time
an algorithm can possibly take to
complete.
Example:
We have one array named " arr" and an
integer " k ". we need to find if that integer
" k " is present in the array " arr " or not?

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Big Omega Notation Ω (n)
Big Omega Notation Ω (n)
It is the formal way to express the lower
bound of an algorithm’s running time. It
measures the best case time complexity
or the best amount of time an algorithm
can possibly take to complete.
Example:
We have one array named " arr" and an
integer " k ". we need to find if that integer
" k " is present in the array " arr " or not?

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Theta Notation Θ
Theta Notation Θ
It is used to find the average bound of an
algorithm. A formal way of expressing
both the lower bound and the upper
bound of an algorithm’s running time.

Example:
We have one array named " arr" and an
integer " k ". we need to find if that integer
" k " is present in the array " arr " or not?

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University
Fundamental Types of Algorithms
Fundamental Types of Algorithms
• Brute Force Algorithm
• Recursive Algorithm
(Divide & Conquer, Dynamic Programing, Greedy, Backtracking)
• Randomize Algorithm
• Sorting Algorithm
• Searching Algorithm
• Hashing Algorithm

Course Instructors: Mary Gift D. Dionson, LPT, MSCS


Markh B. Jamandre, MSCS DATA STRUCTURES and ALGORITHMS STI West Negros University

You might also like