Transcript
1 | P a g e
HUMAN COMPUTER INTERACTION II IT Elective 2 MODULE
DATA
STRUCTURES
AND
ALOGORITHM
Author
ARISTOTLE C. MAYORCA, MSIT
FERDINAND M. FERNANDO
Republic of the Philippines UNIVERSITY OF RIZAL SYSTEM
Province of Rizal
Course Guide
for
DATA STRUCTURE AND ALGORITHMS
BSIT Program 1st Semester, AY 2020 – 2021
Introduction Data Structures are the programmatic way of storing data so that data can be used
efficiently. Almost every enterprise application uses various types of data structures in
one or the other way. This tutorial will give you a great understanding on Data Structures
needed to understand the complexity of enterprise level applications and need of
algorithms, and data structures.
Hi..my name is ARISTOTLE C. MAYORCA, I am an IT
instructor at University of Rizal System Binangonan Campus and
I handled some of the major subject in BSIT and BSIS courses.
My Undergraduate course is Bachelor of Science in Computer
Science. I also earned a supplemental units at University of Rizal
System Morong campus and at the year 2017 I finished my
Masteral degree,with the course of Master of Science
Information Technology in Rizal Technological University, and I
have been a Computer Technician after I finished and pass the
National Certification NCII.
(NISMED). Between 1987 and 1989, while earning BSE supplemental units and units in
the graduate school for MA in Industrial Ed., he was also a grantee of JICA-JOCV (Japan
International Cooperation Agency-Japan Overseas Cooperation Volunteer) training under
system Engr. Hiroshi Aruga of the University of Tokyo. I was the author of the BS
Computer Science course at the Tomas Claudio College (formerly TCMC) in the 1990s.
Currently an Assistant Professor at the College of Engineering URS Morong.
Course Objectives: General objectives
1. Analyze complex problems and identify and define the computing requirements needed to design an appropriate solution;
2. Apply computing and other knowledge domains to address real-world problems; 3. Design and develop computing solutions using a system-level perspective; 4. Utilize modern computing tools.
Specific Objectives: 1. Be able to discuss, explain and introduce Data structure and algorithms.
Familiarized the network to be used in the subject. 2. Be able to discuss, explain, learn and apply the different Fundamental Data
Structures like Arrays and linked Lists. 3. Apply techniques and methods on using Arrays and linked Lists. 4. Make use of a step-by-step approach applying arrays in different situations. 5. Identify the Characteristics and Terminologies of trees 6. Be able to discuss, explain and apply the how Graphs and Other Advanced Data
Structures works.
Pre-Requisite
ITE 5
I am Prof. Ferdinand M. Fernando, a graduate of BSECE
currently teaches different computer and electronics courses
in the ECE, CPE, and EE programs of the College of
Engineering in URS Morong Campus. I started teaching since
1986 in the then Rizal Technological and Polytechnic Institute
(now, URS). From 1989 up to 1991 I was the Computer
Courseware Specialist in UP-ISMED, now National Institute for
Science and Mathematics Education Development (NISMED).
Between 1987 and 1989, while earning BSE supplemental
units and units in the graduate school for MA in Industrial Ed.,
he was also a grantee of JICA-JOCV (Japan International
Cooperation Agency-Japan Overseas Cooperation Volunteer)
training under system Engr. Hiroshi Aruga of the University of
Tokyo. He was the author of the BS Computer Science course
at the Tomas Claudio College (formerly TCMC) in the 1990s.
Currently he is an Assistant Professor at the College of
Engineering URS Morong.
Course Materials
Computers, pdf file, text books covers analysis and design of fundamental data
structures and engages students to have access to computer equipment with
certain requirements. ... that you have acquired a command of the general subject matter,
knowledge.
COURSE CONTENT
UNIT 1 - Introductions of Data Structure and Algorithm
Module 1. Introduction of Data Structure and Algorithm Analysis
Module 2. Fundamentals of Arrays
Module 3. Fundamentals of, Linked list and
Module 4. Fundamentals of Recursion
UNIT 2 – Introductions of Stacks, Queues, Heaps and Trees
Module 5. Fundamentals of Stacks Module 6. Fundamentals of Queues Module 7. Characteristics and Terminologies of Trees Module 8. Fundamentals of Heaps
UNIT 3 – Graphs and Sorting Algorithms
Module 9. Fundamentals and Graphs Representations
Module 10. Fundamentals of Sorting Algorithms
Activity Schedule
Welcome Activity and Course Orientation
Week 1 – Aug 24 – 28, 2020
Via Google Meet
Module 1
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Aug 25 - 28, 2020
To be submitted on Aug. 28 through google
class room
Module 2
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Aug 31 –Sept 4, 2020
Via Google Meet
To be submitted on Sept.4 through google
class room
Module 3
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Sept 7 – 25, 2020
Via Google Meet on Sept. 10 To be submitted on Sept.25 through google
class room
Module 4
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Sept 28 - Oct 2, 2020
To be submitted on Oct 1-2 through google
class room
PRELIM EXAM
Module 5
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Oct 5 – Oct 9, 2020
Via Google meet
To be submitted on Oct 9 through google
class room
Module 6
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Oct 12 – Oct 16, 2020
Via Google meet
To be submitted on Nov. 15-16 through
google class room
Module 7
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Oct 19 – Oct 26, 2020
Via Google meet
To be submitted on Oct 29 through google
class room
Module 8
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Oct 28– Nov 4, 2020
Via Google meet
To be submitted on Nov. 5-6 through google
class room
MIDTERM EXAM Nov 9 -13, 2020
Module 9
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Nov 16 – Nov 27, 2020
Via Google meet
To be submitted on Nov. 27 through google
class room
Module 10
Read and Discuss the Lectures
Do Activity’s
Answer the SAQ
Nov 30 – Dec 11, 2020
Via Google meet
To be submitted on Dec. 12-13 through
google class room
FINAL EXAM
Submission of Hands-on Activities
For Quizzes
There will be no special quizzes. For Hands on Activities
Activities should be submitted on the scheduled date of submission For Term Exams
Term Examination can be given to student who has valid reason for not taking the exam
Student caught cheating will automatically have a grade of 5.0 for that particular exam.
Failure to take term exams and final project will be marked as incomplete.
Grading System
Student’s progress, productivity and learning in information technology will be assessed and evaluated based on demonstrated performance, completion and quality of course assignments and activities that may include: exams, quizzes, homework assignments,
participation in class lectures, attendance and participation in laboratory sessions, team‐member or individual project development, and other assignments as specified by the Instructor.
Examination (Prelim/Midterm/Finals) - 40%
Quizzes - 30% Written and Hands-on Activities - 30% Total - 100%
About the author
My Name is ARISTOTLE C. MAYORCA, I am an IT instructor at University of Rizal
System Binangonan Campus,. My Undergraduate course is Bachelor of Science in
Computer Science. I also finished my Masteral degree of Master of Science Information
Technology in Rizal Technological University, I have been an Computer Technician after
a finished and pass the National Certification NCII.
I am Prof. Ferdinand M. Fernando, a graduate of BSECE currently teaches different
computer and electronics courses in the ECE, CPE, and EE programs of the College of
Engineering in URS Morong Campus. He started teaching since 1986 in the then Rizal
Technological and Polytechnic Institute (now, URS). From 1989 up to 1991 he was the
Computer Courseware Specialist in UP-ISMED, now National Institute for Science and
Mathematics Education Development (NISMED). Between 1987 and 1989, while
earning BSE supplemental units and units in the graduate school for MA in Industrial
Ed., he was also a grantee of JICA-JOCV (Japan International Cooperation Agency-
Japan Overseas Cooperation Volunteer) training under system Engr. Hiroshi Aruga of
the University of Tokyo. He was the author of the BS Computer Science course at the
Tomas Claudio College (formerly TCMC) in the 1990s. Currently he is an Assistant
Professor at the College of Engineering URS Morong.
As a developer, you have certainly heard about various data structures and algorithms.
However, have you ever thought profoundly about them and their impact on the
performance of your applications? If not, it is high time to take a look at this topic, and
this is a great place to start!
Preface
We study data structures so that we can learn to write more efficient
programs. But why must programs be efficient when new computers are
faster every year? The reason is that our ambitions grow with our
capabilities. Instead of rendering efficiency needs obsolete, the modern
revolution in computing power and storage capability merely raises the
efficiency stakes as we computerize more complex tasks. The quest for
program efficiency need not and should not conflict with sound design and
clear coding. Creating efficient programs has little to do with “programming
tricks” but rather is based on good organization of information and good
algorithms. A programmer who has not mastered the basic principles of
clear design is not likely to write efficient programs. Conversely, “software
engineering” cannot be used as an excuse to justify inefficient performance.
Generality in design can and should be achieved without sacrificing
performance, but this can only be done if the designer understands how to
measure performance and does so as an integral part of the design and
implementation process. Most computer science curricula recognize that
good programming skills begin with a strong emphasis on fundamental
software engineering principles. Then, once a programmer has learned the
principles of clear program design and implementation, the next step is to
study the effects of data organization and algorithms on program efficiency
Objectives:
Identify the abstract data types
Describe algorithm
Differentiate space complexity from time complexity
Compare types of analysis
Data Structures
• A data structure is a special format for storing and organizing data. • Two (2) types of data structure:
o Linear: Elements are accessed in a sequential order but may be stored unsystematically.
o Non-Linear: Elements are stored and accessed in a non-sequential order.
• An abstract data type (ADT) is a logical description of how data is viewed as well as the operations that are allowed without regard to how they will be implemented.
• Benefits of using ADT:
o Code is easier to understand. o Implementations of ADTs can be changed without requiring changes to the
program that uses the ADTs. o ADTs can be used in future programs
• Two (2) parts of ADT:
o Public or external – the data and the operations o Private or internal – the representation and the implementation
UNIT I – MODULE 1
Fundamentals of Data Structure and Algorithm
Analysis
four (4) main operations that could be defined for each ADT are initializing,
adding, accessing, and removing of data.
Algorithm
• An algorithm is a step-by-step set of instructions to be executed in sequence for solving a problem.
• Characteristics of an algorithm:
o Finiteness: An algorithm must terminate after a specified number of steps.
o Definiteness: Each instruction has to be clear and unambiguous. o Input: An algorithm should have zero or more well- defined data given
before the algorithm begins. o Output: An algorithm must have one (1) or more results, with specified
relation to the input. o Uniqueness: The result of each step depends on the input and/or the
result of the previous step.
• Abstract data types:
o Linked list is used for storing elements where each is a separate object. o o Stack is an ordered list in which insertion and deletion are done at one (1)
end.
o Queue is an ordered list in which insertion and deletion are done at separate ends.
o Tree represents a hierarchical nature of a structure in a graphical form.
o Priority queue is used for retrieving and removing either the minimum or maximum element.
o Heap is a partially sorted binary tree.
o Set represents a collection of elements that do not have to be in order.
o Map is a set of ordered pairs with elements known as key and value.
o Graph consists of a set of points/nodes (vertices) and set of links (edges) which connects the pairs of vertices.
• Elements of an algorithm:
o Sequential operations o Actions based on the state of a data structure o Iteration – repeating an action multiple times o Recursion – when a function calls itself once or multiple times to solve a
problem
• Algorithm design paradigms:
o Divide and Conquer – breaking a problem into smaller sub problems o Greedy Algorithms – always chooses the optimal approach in solving a
problem o Dynamic Programming – similar to divide and conquer except that the
results of the sub problems are reused for overlapping sub problems
How to Write an Algorithm?
• There are no well-defined standards for writing algorithms. Rather, it is problem and resource dependent. Algorithms are never written to support a particular programming code.
• As we know that all programming languages share basic code constructs like loops (do, for, while), flow-control (if-else), etc. These common constructs can be used to write an algorithm.
• We write algorithms in a step-by-step manner, but it is not always the case. Algorithm writing is a process and is executed after the problem domain is well-defined. That is, we should know the problem domain, for which we are designing a solution.
Example Let's try to learn algorithm-writing by using an example Problem − Design an algorithm to add two numbers and display the result.
• Step 1 − START
• Step 2 − declare three integers a, b & c
• Step 3 − define values of a & b
• Step 4 − add values of a & b
• Step 5 − store output of step 4 to c
• Step 6 − print c
• Step 7 − STOP
• Algorithms tell the programmers how to code the program. Alternatively, the algorithm can be written as –
• Step 1 − START ADD
• Step 2 − get values of a & b
• Step 3 − c ← a + b
• Step 4 − display c
• Step 5 − STOP
In design and analysis of algorithms, usually the second method is used to describe an algorithm. It makes it easy for the analyst to analyze the algorithm ignoring all unwanted definitions. He can observe what operations are being used and how the process is flowing.
Writing step numbers, is optional.
We design an algorithm to get a solution of a given problem. A problem can be solved in more than one ways.
Hence, many solution algorithms can be derived for a given problem. The next
step is to analyze those proposed solution algorithms and implement the best
suitable solution.
PSEUDOCODE & ALGORITHM
Pseudocode:
•Input a set of 4 marks
• Calculate their average by summing and dividing by 4
• if average is below 50 Print “FAIL” else Print “PASS
Detailed Algorithm
Step 1: Input M1,M2,M3,M4
Step 2: GRADE ¬ (M1+M2+M3+M4)/4
Step 3: if (GRADE < 50) then Print “FAIL” else Print “PASS” endif
Example 1: Write an algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks.
Reference
Books
Karumanchi, N. (2017). Data structures and algorithms made easy. Hyderabad:
CareerMonk Publications.
TechDifferences (n.d.). Differences between array and linked list. Retrieved from
https://techdifferences.com/difference-between-array-and-linked-list.html
Pdf Files
csharp-data-structures-and-algorithms.pdf
ACTIVITY
The purpose of this activity is to make students! Realize the limitations of using an array
& the need of a new & better data structure for storage purpose.
1. What if three elements are already added in array (say apple, banana & orange) keeping
alphabetical order in mind. Now you want to insert another element “Mango” in it. In case
of an array there is a need to move the entire elements one index further that comes after
mango and place mango on its place.
Self-Assessment Questionnaire
This sample quiz / exams will type in the google classroom or in the google form
Quiz in Data Structure and Algorithm analysis
1. Which if the following is/are the levels of implementation of data structure A) Abstract level B) Application level C) Implementation level D) All of the above 2. A binary search tree whose left subtree and rightsubtree differ in hight by at most 1 unit is called ……
A) AVL tree B) Red-black tree C) Lemma Tree D) None of the above
3. ……………….. level is where the model becomes compatible executable code A) Abstract level B) Application level C) Implementation level D) All of the above 4. Stack is also called as A) Last in first out B) First in last out C) Last in last out D) First in first out 5. Which of the following is true about the characteristics of abstract data types?
i) It exports a type. ii) ii) It exports a set of operations
A) True, False B) False, True C) True, True D) False, False
Answer to Self-Assessment Questionnaire
Data Structure and Algorithm analysis
1. D
2. A
3. C
4. A
5. C
top related