SlideShare a Scribd company logo
College of Computing & Information Technology
King Abdulaziz University
Data Structures I
CPCS-204 – Introduction
CPCS-204 – Data Structures I
Data Structures I: An Introduction page 2
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Course Learning Outcomes
 Upon completion of this course, you will be able to:
1. Describe the needs of data structures in problem solving.
2. Design and implement abstract data types.
3. Represent and implement linear/non-linear data
structures.
4. Build stacks and queues using arrays and linked lists.
5. Select and apply appropriate data structures in problem
solving.
6. Select and apply basic searching and sorting algorithms
in problem solving.
7. Apply recursion to solve simple problems.
8. Trace the output of a given piece of code or algorithm.
Data Structures I: An Introduction page 3
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 How is CPCS-204 different than CPCS-203?
 CPCS-203 teaches how to program in Java
 Language basics, variable declarations, conditional
expressions, if statements, loops, functions, arrays,
structures, and even Object-Oriented programming
 This will not be covered in this class
 You will need to freshen up on your Java very quickly
 If you need help, but a good Java-language book or find a
quality reference online
 With respect to Java, we will cover:
 Arrays and array processing (although already taught)
 Some of the Java Collections as needed
Data Structures I: An Introduction page 4
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 The goals of Data Structures I:
 Improve knowledge of standard data structures
and abstract data types
 Improve knowledge of standard algorithms used
to solve several classical problems
 Cover some mathematical concepts that are
useful for the analysis of algorithms
 Analyze the efficiency of solutions to problems
 Learn about and be comfortable with recursion
Data Structures I: An Introduction page 5
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 The goals of Computer Science I:
 In CPCS-202 and 203, we only cared if we
found a solution to the problem at hand
 Didn’t really pay attention to the efficiency of the
answer
 For this class:
 We learn standard ways to solve problems
 And how to analyze the efficiency of those solutions
 Finally, we simply expand upon our knowledge of our
use of the JAVA programming language
Data Structures I: An Introduction page 6
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Teaching Method:
 This class is NOT used to teach you JAVA
 The focus of CPCS-202 and 203 (not this class) is to
teach you JAVA
 You should know JAVA already
 In CPCS-202 and 203, majority of time was spent going
of syntax of JAVA
 Programs were often shown in class
 Programs were even written during class
 Essentially a requirement for any course teaching a
programming language
Data Structures I: An Introduction page 7
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Teaching Method:
 Majority of this class is used covering new data
structures, abstract data types, and algorithm
analysis
 The teaching of these concepts dictate more
explanation and less of a focus on “code”
 Some code will be shown on the PowerPoint slides
 Such as after we explain a new abstract data type
 We’ll show the code of how you would implement it
 However, writing of actual code will most likely
never be done in class
 Again, that is not the purpose of this class
Data Structures I: An Introduction page 8
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Example Problem:
 We will now go over two solutions to a problem
 The first is a straightforward solution that a CPCS-203
student should be able to come up with
 Doesn’t’ care about efficiency
 The second solution is one that a CPCS-204 student
should be able to come up with after some thought
 Cares about efficiency
 Hopefully this example will illustrate part of the
goal of this course
Data Structures I: An Introduction page 9
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Max Number of 1’s:
 You are given an nxn integer array
 Say, for example, a 100x100 sized array
 Each row is filled with several 1’s followed by all
0’s
 Example:
 Row 1 may have 38 1’s followed by 62 0’s
 Row 2 may have 73 1’s followed by 27 0’s
 Row 3 may have 12 1’s followed by 82 0’s
 You get the idea
 The goal of the problem is to identify the row
that has the maximum number of 1’s.
Data Structures I: An Introduction page 10
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Max Number of 1’s:
 Straightforward CPCS-203 style solution:
 Make a variable called MaxOnes and set equal
to 0
 For each row do the following:
 Start from the beginning of the row on the left side
 Scan left to right, counting the number of 1’s until the first zero
is encountered
 If the number of 1’s is greater than the value stored in
MaxOnes, update MaxOnes with the number of 1’s seen on
this row
 Clearly, this works
 But let’s see how long this algorithm will take
Data Structures I: An Introduction page 11
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Max Number of 1’s:
 Analysis of Straightforward Solution:
 Basically we iterate through each square that contains
a 1, as well as the first 0 in each row
 If all cells were 0, we would only “visit” one cell per
row, resulting in n visited cells
 However, if all cells were 1’s, we would “visit” all of the
cells (n2 total)
 So in the worst case, the number of simple steps the
algorithm takes would be approximately n2
 This makes the running time of this algorithm O(n2)
 The meaning of this Big-O will be discussed later in the
semester
Data Structures I: An Introduction page 12
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Max Number of 1’s:
 Analysis of Straightforward Solution:
 There seems to be extra work done here
 Once we know that a row has 12 1’s, for example, it
seems pointless to start checking at the beginning of
the next row
 Why not just start at column 12
 If it’s a 0, then that row can’t be the winner
 If it is a 1, then clearly there is no point in going back, on
that row, and checking the previous 11 squares
 This idea leads to a more efficient algorithm
Data Structures I: An Introduction page 13
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Max Number of 1’s:
 More Efficient CPCS-204 style algorithm:
1. Initialize the current row and current column to 0
2. While the current row is less than n (or before the
last row)
a. While the cell at the current row and column is 1
 Increment the current column
b. Increment the current row
3. The current column index represents the
maximum number of 1’s seen
4. Now let’s trace through a couple of examples
Data Structures I: An Introduction page 14
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Max Number of 1’s:
 Example 1:
1 1 0 0 0 0
0 0 0 0 0 0
1 1 1 0 0 0
1 1 1 0 0 0
1 1 1 1 1 0
1 1 1 1 0 0
Data Structures I: An Introduction page 15
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Max Number of 1’s:
 Example 2:
0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0
1 1 1 1 0 0 0 0
1 1 1 1 1 1 0 0
1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1
Data Structures I: An Introduction page 16
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Max Number of 1’s:
 Analysis of Better Solution:
 How many steps will this algorithm take, in terms of n?
 Each “step” taken by the algorithm either goes to the right
or down in the table.
 There are a maximum of n-1 steps to the right
 And a maximum of n-1 steps down that could be taken
 Thus the maximum number of “steps” that can be done
during this algorithm is approximately 2n
 And this is the worst case
 So the running time of this algorithm is O(n)
 An improvement of the previous algorithm
 Input size of 100 for n
 n2 would be 10,000 steps and 2n would be 200 steps
Data Structures I: An Introduction page 17
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Implementing an Algorithm in JAVA:
 In this class, you will have an opportunity to
improve upon your ability to write programs that
implement an algorithm you have learned
 You must know the syntax of JAVA in order to
properly and effective do this
 There’s no set way to create code to implement
an algorithm
 But this example shows some steps you can take in
doing so
Data Structures I: An Introduction page 18
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Implementing an Algorithm in JAVA:
 Here are some issues to think about:
1. What data structures are going to be used?
2. What functions are going to be used?
3. What run-time errors should we protect
against?
4. What atypical cases may we have to deal with?
5. What is an efficient way to execute the steps in
the algorithm?
Data Structures I: An Introduction page 19
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
 Maximum Number of 1’s
 This was a creative exercise
 Much of what you learn in class will not be
 We have many set algorithms and data
structures that you will study
 Occasionally you will have to come up with new
ideas like this one
 Mostly, however, you will simply have to apply
the data structures and algorithms shown in
class fairly directly to solve the given problems
Data Structures I: An Introduction page 20
© Dr. Jonathan (Yahya) Cazalas
Data Structures 1: Introduction
Are
You
Excited?
Data Structures I: An Introduction page 21
© Dr. Jonathan (Yahya) Cazalas
Daily FAIL Picture
 Fail pictures
 During the slides (or at the end), we will often
give a funny “fail” picture or a “human stupidity”
picture
 Helps to “lighten things up”
 So here you go:
Data Structures I: An Introduction page 22
© Dr. Jonathan (Yahya) Cazalas
Human Stupidity
College of Computing & Information Technology
King Abdulaziz University
Data Structures I
CPCS-204 – Introduction
CPCS-204 – Data Structures I

More Related Content

What's hot

Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
iqbalphy1
 
Data structure and algorithm notes
Data structure and algorithm notesData structure and algorithm notes
Data structure and algorithm notes
suman khadka
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES
UNIT II 	LINEAR DATA STRUCTURES – STACKS, QUEUES	UNIT II 	LINEAR DATA STRUCTURES – STACKS, QUEUES
UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES
Kathirvel Ayyaswamy
 
Big O Notation
Big O NotationBig O Notation
Big O Notation
Marcello Missiroli
 
2 a stacks
2 a stacks2 a stacks
2 a stacks
Nguync91368
 
Chapter 10 ds
Chapter 10 dsChapter 10 ds
Chapter 10 ds
Hanif Durad
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
Sumathi MathanMohan
 
1 list datastructures
1 list datastructures1 list datastructures
1 list datastructures
Nguync91368
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structure
eShikshak
 
Big o notation
Big o notationBig o notation
Big o notation
hamza mushtaq
 
2 b queues
2 b queues2 b queues
2 b queues
Nguync91368
 
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSPYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMS
Aniruddha Paul
 
Searching Algorithms
Searching AlgorithmsSearching Algorithms
Searching Algorithms
Afaq Mansoor Khan
 
3 recursion
3 recursion3 recursion
3 recursion
Nguync91368
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
irdginfo
 
Dynamic Memory & Linked Lists
Dynamic Memory & Linked ListsDynamic Memory & Linked Lists
Dynamic Memory & Linked Lists
Afaq Mansoor Khan
 
Data structure
Data structureData structure
Data structure
Muhammad Farhan
 
Recursion and Sorting Algorithms
Recursion and Sorting AlgorithmsRecursion and Sorting Algorithms
Recursion and Sorting Algorithms
Afaq Mansoor Khan
 
Recursion(Advanced data structure)
Recursion(Advanced data structure)Recursion(Advanced data structure)
Recursion(Advanced data structure)
kurubameena1
 

What's hot (20)

Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Data structure and algorithm notes
Data structure and algorithm notesData structure and algorithm notes
Data structure and algorithm notes
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES
UNIT II 	LINEAR DATA STRUCTURES – STACKS, QUEUES	UNIT II 	LINEAR DATA STRUCTURES – STACKS, QUEUES
UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES
 
Big O Notation
Big O NotationBig O Notation
Big O Notation
 
2 a stacks
2 a stacks2 a stacks
2 a stacks
 
Chapter 10 ds
Chapter 10 dsChapter 10 ds
Chapter 10 ds
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
1 list datastructures
1 list datastructures1 list datastructures
1 list datastructures
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structure
 
Big o notation
Big o notationBig o notation
Big o notation
 
2 b queues
2 b queues2 b queues
2 b queues
 
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMSPYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMS
 
Searching Algorithms
Searching AlgorithmsSearching Algorithms
Searching Algorithms
 
3 recursion
3 recursion3 recursion
3 recursion
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
 
Dynamic Memory & Linked Lists
Dynamic Memory & Linked ListsDynamic Memory & Linked Lists
Dynamic Memory & Linked Lists
 
Data structure
Data structureData structure
Data structure
 
Recursion and Sorting Algorithms
Recursion and Sorting AlgorithmsRecursion and Sorting Algorithms
Recursion and Sorting Algorithms
 
Recursion(Advanced data structure)
Recursion(Advanced data structure)Recursion(Advanced data structure)
Recursion(Advanced data structure)
 

Similar to introduction

algo 1.ppt
algo 1.pptalgo 1.ppt
algo 1.ppt
example43
 
EE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptxEE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptx
iamultapromax
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
SisayNegash4
 
End-to-End Machine Learning Project
End-to-End Machine Learning ProjectEnd-to-End Machine Learning Project
End-to-End Machine Learning Project
Eng Teong Cheah
 
Exploratory data analysis v1.0
Exploratory data analysis v1.0Exploratory data analysis v1.0
Exploratory data analysis v1.0
Vishy Chandra
 
A tour of the top 10 algorithms for machine learning newbies
A tour of the top 10 algorithms for machine learning newbiesA tour of the top 10 algorithms for machine learning newbies
A tour of the top 10 algorithms for machine learning newbies
Vimal Gupta
 
Data Structures- Part1 overview and review
Data Structures- Part1 overview and reviewData Structures- Part1 overview and review
Data Structures- Part1 overview and review
Abdullah Al-hazmy
 
Intro_2.ppt
Intro_2.pptIntro_2.ppt
Intro_2.ppt
MumitAhmed1
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
SharabiNaif
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
Anonymous9etQKwW
 
Lect1.pptx
Lect1.pptxLect1.pptx
Troubleshooting Deep Neural Networks - Full Stack Deep Learning
Troubleshooting Deep Neural Networks - Full Stack Deep LearningTroubleshooting Deep Neural Networks - Full Stack Deep Learning
Troubleshooting Deep Neural Networks - Full Stack Deep Learning
Sergey Karayev
 
9th Comp Ch 1 LQ.pdf
9th Comp Ch 1 LQ.pdf9th Comp Ch 1 LQ.pdf
9th Comp Ch 1 LQ.pdf
Naeem Mughal
 
Algorithm
AlgorithmAlgorithm
Algorithm
nivlayalat
 
Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo code
hamza javed
 
Andrew NG machine learning
Andrew NG machine learningAndrew NG machine learning
Andrew NG machine learning
ShareDocView.com
 
Lecture#1(Algorithmic Notations).ppt
Lecture#1(Algorithmic Notations).pptLecture#1(Algorithmic Notations).ppt
Lecture#1(Algorithmic Notations).ppt
MuhammadTalhaAwan1
 
MICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMSMICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMS
ARVIND SARDAR
 
RAJAT PROJECT.pptx
RAJAT PROJECT.pptxRAJAT PROJECT.pptx
RAJAT PROJECT.pptx
SayedMohdAsim2
 
notes as .ppt
notes as .pptnotes as .ppt
notes as .ppt
butest
 

Similar to introduction (20)

algo 1.ppt
algo 1.pptalgo 1.ppt
algo 1.ppt
 
EE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptxEE-232-LEC-01 Data_structures.pptx
EE-232-LEC-01 Data_structures.pptx
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
End-to-End Machine Learning Project
End-to-End Machine Learning ProjectEnd-to-End Machine Learning Project
End-to-End Machine Learning Project
 
Exploratory data analysis v1.0
Exploratory data analysis v1.0Exploratory data analysis v1.0
Exploratory data analysis v1.0
 
A tour of the top 10 algorithms for machine learning newbies
A tour of the top 10 algorithms for machine learning newbiesA tour of the top 10 algorithms for machine learning newbies
A tour of the top 10 algorithms for machine learning newbies
 
Data Structures- Part1 overview and review
Data Structures- Part1 overview and reviewData Structures- Part1 overview and review
Data Structures- Part1 overview and review
 
Intro_2.ppt
Intro_2.pptIntro_2.ppt
Intro_2.ppt
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
 
Lect1.pptx
Lect1.pptxLect1.pptx
Lect1.pptx
 
Troubleshooting Deep Neural Networks - Full Stack Deep Learning
Troubleshooting Deep Neural Networks - Full Stack Deep LearningTroubleshooting Deep Neural Networks - Full Stack Deep Learning
Troubleshooting Deep Neural Networks - Full Stack Deep Learning
 
9th Comp Ch 1 LQ.pdf
9th Comp Ch 1 LQ.pdf9th Comp Ch 1 LQ.pdf
9th Comp Ch 1 LQ.pdf
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Algorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo codeAlgorithm and flowchart with pseudo code
Algorithm and flowchart with pseudo code
 
Andrew NG machine learning
Andrew NG machine learningAndrew NG machine learning
Andrew NG machine learning
 
Lecture#1(Algorithmic Notations).ppt
Lecture#1(Algorithmic Notations).pptLecture#1(Algorithmic Notations).ppt
Lecture#1(Algorithmic Notations).ppt
 
MICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMSMICRO PROJECT 22319 DMS
MICRO PROJECT 22319 DMS
 
RAJAT PROJECT.pptx
RAJAT PROJECT.pptxRAJAT PROJECT.pptx
RAJAT PROJECT.pptx
 
notes as .ppt
notes as .pptnotes as .ppt
notes as .ppt
 

More from Mohamed Elsayed

binary_trees4
binary_trees4binary_trees4
binary_trees4
Mohamed Elsayed
 
binary_trees3
binary_trees3binary_trees3
binary_trees3
Mohamed Elsayed
 
binary_trees2
binary_trees2binary_trees2
binary_trees2
Mohamed Elsayed
 
binary_trees1
binary_trees1binary_trees1
binary_trees1
Mohamed Elsayed
 
queues
queuesqueues
stacks2
stacks2stacks2
algorithm_analysis2
algorithm_analysis2algorithm_analysis2
algorithm_analysis2
Mohamed Elsayed
 
algorithm_analysis1
algorithm_analysis1algorithm_analysis1
algorithm_analysis1
Mohamed Elsayed
 
recursion3
recursion3recursion3
recursion3
Mohamed Elsayed
 
recursion2
recursion2recursion2
recursion2
Mohamed Elsayed
 
recursion1
recursion1recursion1
recursion1
Mohamed Elsayed
 
linked_lists4
linked_lists4linked_lists4
linked_lists4
Mohamed Elsayed
 
linked_lists3
linked_lists3linked_lists3
linked_lists3
Mohamed Elsayed
 
Linked_lists2
Linked_lists2Linked_lists2
Linked_lists2
Mohamed Elsayed
 
linked_lists
linked_listslinked_lists
linked_lists
Mohamed Elsayed
 
sorted_listmatch
sorted_listmatchsorted_listmatch
sorted_listmatch
Mohamed Elsayed
 
binary_search
binary_searchbinary_search
binary_search
Mohamed Elsayed
 
heaps2
heaps2heaps2
heaps
heapsheaps
hash_tables
hash_tableshash_tables
hash_tables
Mohamed Elsayed
 

More from Mohamed Elsayed (20)

binary_trees4
binary_trees4binary_trees4
binary_trees4
 
binary_trees3
binary_trees3binary_trees3
binary_trees3
 
binary_trees2
binary_trees2binary_trees2
binary_trees2
 
binary_trees1
binary_trees1binary_trees1
binary_trees1
 
queues
queuesqueues
queues
 
stacks2
stacks2stacks2
stacks2
 
algorithm_analysis2
algorithm_analysis2algorithm_analysis2
algorithm_analysis2
 
algorithm_analysis1
algorithm_analysis1algorithm_analysis1
algorithm_analysis1
 
recursion3
recursion3recursion3
recursion3
 
recursion2
recursion2recursion2
recursion2
 
recursion1
recursion1recursion1
recursion1
 
linked_lists4
linked_lists4linked_lists4
linked_lists4
 
linked_lists3
linked_lists3linked_lists3
linked_lists3
 
Linked_lists2
Linked_lists2Linked_lists2
Linked_lists2
 
linked_lists
linked_listslinked_lists
linked_lists
 
sorted_listmatch
sorted_listmatchsorted_listmatch
sorted_listmatch
 
binary_search
binary_searchbinary_search
binary_search
 
heaps2
heaps2heaps2
heaps2
 
heaps
heapsheaps
heaps
 
hash_tables
hash_tableshash_tables
hash_tables
 

Recently uploaded

Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 

Recently uploaded (20)

Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 

introduction

  • 1. College of Computing & Information Technology King Abdulaziz University Data Structures I CPCS-204 – Introduction CPCS-204 – Data Structures I
  • 2. Data Structures I: An Introduction page 2 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Course Learning Outcomes  Upon completion of this course, you will be able to: 1. Describe the needs of data structures in problem solving. 2. Design and implement abstract data types. 3. Represent and implement linear/non-linear data structures. 4. Build stacks and queues using arrays and linked lists. 5. Select and apply appropriate data structures in problem solving. 6. Select and apply basic searching and sorting algorithms in problem solving. 7. Apply recursion to solve simple problems. 8. Trace the output of a given piece of code or algorithm.
  • 3. Data Structures I: An Introduction page 3 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  How is CPCS-204 different than CPCS-203?  CPCS-203 teaches how to program in Java  Language basics, variable declarations, conditional expressions, if statements, loops, functions, arrays, structures, and even Object-Oriented programming  This will not be covered in this class  You will need to freshen up on your Java very quickly  If you need help, but a good Java-language book or find a quality reference online  With respect to Java, we will cover:  Arrays and array processing (although already taught)  Some of the Java Collections as needed
  • 4. Data Structures I: An Introduction page 4 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  The goals of Data Structures I:  Improve knowledge of standard data structures and abstract data types  Improve knowledge of standard algorithms used to solve several classical problems  Cover some mathematical concepts that are useful for the analysis of algorithms  Analyze the efficiency of solutions to problems  Learn about and be comfortable with recursion
  • 5. Data Structures I: An Introduction page 5 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  The goals of Computer Science I:  In CPCS-202 and 203, we only cared if we found a solution to the problem at hand  Didn’t really pay attention to the efficiency of the answer  For this class:  We learn standard ways to solve problems  And how to analyze the efficiency of those solutions  Finally, we simply expand upon our knowledge of our use of the JAVA programming language
  • 6. Data Structures I: An Introduction page 6 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Teaching Method:  This class is NOT used to teach you JAVA  The focus of CPCS-202 and 203 (not this class) is to teach you JAVA  You should know JAVA already  In CPCS-202 and 203, majority of time was spent going of syntax of JAVA  Programs were often shown in class  Programs were even written during class  Essentially a requirement for any course teaching a programming language
  • 7. Data Structures I: An Introduction page 7 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Teaching Method:  Majority of this class is used covering new data structures, abstract data types, and algorithm analysis  The teaching of these concepts dictate more explanation and less of a focus on “code”  Some code will be shown on the PowerPoint slides  Such as after we explain a new abstract data type  We’ll show the code of how you would implement it  However, writing of actual code will most likely never be done in class  Again, that is not the purpose of this class
  • 8. Data Structures I: An Introduction page 8 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Example Problem:  We will now go over two solutions to a problem  The first is a straightforward solution that a CPCS-203 student should be able to come up with  Doesn’t’ care about efficiency  The second solution is one that a CPCS-204 student should be able to come up with after some thought  Cares about efficiency  Hopefully this example will illustrate part of the goal of this course
  • 9. Data Structures I: An Introduction page 9 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Max Number of 1’s:  You are given an nxn integer array  Say, for example, a 100x100 sized array  Each row is filled with several 1’s followed by all 0’s  Example:  Row 1 may have 38 1’s followed by 62 0’s  Row 2 may have 73 1’s followed by 27 0’s  Row 3 may have 12 1’s followed by 82 0’s  You get the idea  The goal of the problem is to identify the row that has the maximum number of 1’s.
  • 10. Data Structures I: An Introduction page 10 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Max Number of 1’s:  Straightforward CPCS-203 style solution:  Make a variable called MaxOnes and set equal to 0  For each row do the following:  Start from the beginning of the row on the left side  Scan left to right, counting the number of 1’s until the first zero is encountered  If the number of 1’s is greater than the value stored in MaxOnes, update MaxOnes with the number of 1’s seen on this row  Clearly, this works  But let’s see how long this algorithm will take
  • 11. Data Structures I: An Introduction page 11 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Max Number of 1’s:  Analysis of Straightforward Solution:  Basically we iterate through each square that contains a 1, as well as the first 0 in each row  If all cells were 0, we would only “visit” one cell per row, resulting in n visited cells  However, if all cells were 1’s, we would “visit” all of the cells (n2 total)  So in the worst case, the number of simple steps the algorithm takes would be approximately n2  This makes the running time of this algorithm O(n2)  The meaning of this Big-O will be discussed later in the semester
  • 12. Data Structures I: An Introduction page 12 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Max Number of 1’s:  Analysis of Straightforward Solution:  There seems to be extra work done here  Once we know that a row has 12 1’s, for example, it seems pointless to start checking at the beginning of the next row  Why not just start at column 12  If it’s a 0, then that row can’t be the winner  If it is a 1, then clearly there is no point in going back, on that row, and checking the previous 11 squares  This idea leads to a more efficient algorithm
  • 13. Data Structures I: An Introduction page 13 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Max Number of 1’s:  More Efficient CPCS-204 style algorithm: 1. Initialize the current row and current column to 0 2. While the current row is less than n (or before the last row) a. While the cell at the current row and column is 1  Increment the current column b. Increment the current row 3. The current column index represents the maximum number of 1’s seen 4. Now let’s trace through a couple of examples
  • 14. Data Structures I: An Introduction page 14 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Max Number of 1’s:  Example 1: 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 1 1 0 0
  • 15. Data Structures I: An Introduction page 15 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Max Number of 1’s:  Example 2: 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1
  • 16. Data Structures I: An Introduction page 16 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Max Number of 1’s:  Analysis of Better Solution:  How many steps will this algorithm take, in terms of n?  Each “step” taken by the algorithm either goes to the right or down in the table.  There are a maximum of n-1 steps to the right  And a maximum of n-1 steps down that could be taken  Thus the maximum number of “steps” that can be done during this algorithm is approximately 2n  And this is the worst case  So the running time of this algorithm is O(n)  An improvement of the previous algorithm  Input size of 100 for n  n2 would be 10,000 steps and 2n would be 200 steps
  • 17. Data Structures I: An Introduction page 17 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Implementing an Algorithm in JAVA:  In this class, you will have an opportunity to improve upon your ability to write programs that implement an algorithm you have learned  You must know the syntax of JAVA in order to properly and effective do this  There’s no set way to create code to implement an algorithm  But this example shows some steps you can take in doing so
  • 18. Data Structures I: An Introduction page 18 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Implementing an Algorithm in JAVA:  Here are some issues to think about: 1. What data structures are going to be used? 2. What functions are going to be used? 3. What run-time errors should we protect against? 4. What atypical cases may we have to deal with? 5. What is an efficient way to execute the steps in the algorithm?
  • 19. Data Structures I: An Introduction page 19 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction  Maximum Number of 1’s  This was a creative exercise  Much of what you learn in class will not be  We have many set algorithms and data structures that you will study  Occasionally you will have to come up with new ideas like this one  Mostly, however, you will simply have to apply the data structures and algorithms shown in class fairly directly to solve the given problems
  • 20. Data Structures I: An Introduction page 20 © Dr. Jonathan (Yahya) Cazalas Data Structures 1: Introduction Are You Excited?
  • 21. Data Structures I: An Introduction page 21 © Dr. Jonathan (Yahya) Cazalas Daily FAIL Picture  Fail pictures  During the slides (or at the end), we will often give a funny “fail” picture or a “human stupidity” picture  Helps to “lighten things up”  So here you go:
  • 22. Data Structures I: An Introduction page 22 © Dr. Jonathan (Yahya) Cazalas Human Stupidity
  • 23. College of Computing & Information Technology King Abdulaziz University Data Structures I CPCS-204 – Introduction CPCS-204 – Data Structures I