Professional Documents
Culture Documents
Data Structure
Data Structure
Contents:
Definition of terms
Algorithm example
Pseudo codes
Example program
Output of the program
DEFINITION OF TERMS
Data: Collection of raw facts. Pseudo Codes – These are close to natural
languages that serve as a textual
Data Structure: is representation of the presentation of a flowchart.
logical relationship existing between
individual elements of data. Flowchart – It is a diagram that shows
step-by-step progression through a
operations. symbols.
ALGORITHM :
1. Display “Enter your age”
2. User will input an age from the keyboard
3. Create the condition
4. Display the result
PSEUDO CODES:
ARRAY CONCEPTS
Contents:
Definition of terms
Example program
Output of the program
DEFINITION OF TERMS
Array Array Length
A variable that stores the
Is defined as a set of finite
length of an array
number of homogenous
elements or same data
items.
Syntax
The syntax is the same as
Index for a normal variable
declaration except the
A numeric value starts with variable name should be
zero (0). Each element can follow by subscript to
be accessed via its index specify the size of
dimension of the array
SAMPLE PROGRAM
CODES
SAMPLE PROGRAM
OUTPUT
PRELIM LESSON 3:
STORAGE ALLOCATION /
ARRAY WITH
IMPLEMENTATION OF
LINKED
Contents:
LIST
Definition of terms
Example program
Output of the program
DEFINITION OF TERMS
Key Next
Contains the data All the structure in the
parallel array
STACK Queue
Stack is an abstract data type that holds an ordered, An abstract data structure,
Array
linear sequence of items. In contrast to a queue, a
stack is a last in, first out (LIFO) structure. A real-life
somewhat similar to Stacks.
Unlike stacks, a queue is open
Implementation
example is a stack of plates: you can only take a plate at both its ends. The stack is formed by using the
from the top of the stack, and you can only add a array.
plate to the top of the stack.
Codes :
Output
MIDTERM LESSON 2:
Sequence - an array of elements, a maximum number of elements that the array may contain its
allocated size, and a logical length indicating how many of the allocated elements are valid.
Linear Data Structures - A data structure is said to be linear if its elements form a sequence.
Circular Buffer- is a data structure that uses a single, fixed-size buffer as if it were connected
end-to-end. This structure lends itself easily to buffering data streams.
Traversing Trees
Contents:
Definition of terms
Example program
Output of the program
DEFINITION OF TERMS
Graph Traversal
Refers to the process of visiting
(checking and/or updating) each
vertex in a graph.
Tree Traversal
Is a process in the use of tree models
that evaluates the nodes of a tree on a
systematic basis.
Algorithm
A specific procedure for solving
a well-defined computational
problem
TRAVERSING TREES
CODES :
OUTPUT:
SEMI-FINAL LESSON 2:
SELECTION SORT
ALGORITHM
Contents:
Definition of terms
Example program
Output of the program
DEFINITION OF TERMS
Selection Sort
Algorithm Insertion Sort
Sorts an array by repeatedly Is a simple sorting
finding the minimum element algorithm that builds the
(considering ascending order) final sorted array (or list) one
from unsorted part and putting item at a time.
it at the beginning.
Sort
Sorting the arrangement of data in a
Algorithm prescribed sequence
is an algorithm that
puts elements of
a list into an order.
CODES
OUTPUT
SEMI-FINAL LESSON 3:
QUICK SORT
ALGORITHMContents:
Definition of terms
Example program
Output of the program
DEFINITION OF TERMS
Also called an edge list, is one of the most basic and frequently used
representations of a network. Each edge in the network is indicated by
Adjacency Lists listing the pair of nodes that are connected.
CODES: ADJACENCY
LISTS
OUTPUT: ADJACENCY LISTS
CODES: ADJACENCY MATRIX
OUTPUT: ADJACENCY
MATRIX
FINAL LESSON 2:
HASH TABLES
Contents:
Definition of terms
Example program: (Add, Removing, Changing, Iterating Elements)
Output of the program
DEFINITION OF TERMS
Is a type of fast key lookup data structure that offers a flexible means of
Mapping indexing into its individual elements