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

PDF
PDF
Data Structures and Algorithms Made Easy in Java ( PDFDrive ).pdf
PDF
AI in cloud
PPTX
Data Structures and Algorithm - Module 1.pptx
PPT
Introduction to data structures and Algorithm
PPTX
Event Handling in java
PDF
Set theory
PDF
Tutorial 1 - Introduction to AutoCAD, About & History of AutoCAD, User Interf...
Data Structures and Algorithms Made Easy in Java ( PDFDrive ).pdf
AI in cloud
Data Structures and Algorithm - Module 1.pptx
Introduction to data structures and Algorithm
Event Handling in java
Set theory
Tutorial 1 - Introduction to AutoCAD, About & History of AutoCAD, User Interf...

What's hot (20)

PDF
binary_search
PDF
linked_lists
PPTX
Microsoft Office Excel
PPTX
3. sql logical operators
PDF
Oracle SQL Basics
PPT
PDF
ch 2. Python module
PPTX
Design patterns
PPTX
Parameters in Tableau
PDF
MySQL INDEXES
PPTX
Unit 4 Concurrency control.pptx dbms lovely
PPTX
Sql fundamentals
PPTX
PPTX
Data cleaning using Excel
PPTX
C++ Class & object pointer in c++ programming language
PPTX
Aggregate function
PDF
PPT
SQL select statement and functions
PPT
Joins in SQL
PPTX
1. SQL Basics - Introduction
binary_search
linked_lists
Microsoft Office Excel
3. sql logical operators
Oracle SQL Basics
ch 2. Python module
Design patterns
Parameters in Tableau
MySQL INDEXES
Unit 4 Concurrency control.pptx dbms lovely
Sql fundamentals
Data cleaning using Excel
C++ Class & object pointer in c++ programming language
Aggregate function
SQL select statement and functions
Joins in SQL
1. SQL Basics - Introduction
Ad

Similar to introduction (20)

PPT
algo 1.ppt
PPTX
1-Introduction to Data Structures beginner.pptx
PPTX
EE-232-LEC-01 Data_structures.pptx
PPTX
Lecture 1.pptx
PPTX
End-to-End Machine Learning Project
PDF
Exploratory data analysis v1.0
DOCX
dsa 12217554 AdiMunot 4444444444(1).docx
PDF
A tour of the top 10 algorithms for machine learning newbies
PPT
Data Structures- Part1 overview and review
PPT
Intro_2.ppt
PPT
Intro.ppt
PPT
Intro.ppt
PPTX
PDF
Troubleshooting Deep Neural Networks - Full Stack Deep Learning
PDF
9th Comp Ch 1 LQ.pdf
DOCX
Algorithm
PPTX
Algorithm and flowchart with pseudo code
PDF
Andrew NG machine learning
PDF
Top 50+ Data Science Interview Questions and Answers for 2025 (1).pdf
PPT
Lecture#1(Algorithmic Notations).ppt
algo 1.ppt
1-Introduction to Data Structures beginner.pptx
EE-232-LEC-01 Data_structures.pptx
Lecture 1.pptx
End-to-End Machine Learning Project
Exploratory data analysis v1.0
dsa 12217554 AdiMunot 4444444444(1).docx
A tour of the top 10 algorithms for machine learning newbies
Data Structures- Part1 overview and review
Intro_2.ppt
Intro.ppt
Intro.ppt
Troubleshooting Deep Neural Networks - Full Stack Deep Learning
9th Comp Ch 1 LQ.pdf
Algorithm
Algorithm and flowchart with pseudo code
Andrew NG machine learning
Top 50+ Data Science Interview Questions and Answers for 2025 (1).pdf
Lecture#1(Algorithmic Notations).ppt
Ad

More from Mohamed Elsayed (20)

PDF
binary_trees4
PDF
binary_trees3
PDF
binary_trees2
PDF
binary_trees1
PDF
PDF
PDF
algorithm_analysis2
PDF
algorithm_analysis1
PDF
recursion3
PDF
recursion2
PDF
recursion1
PDF
linked_lists4
PDF
linked_lists3
PDF
Linked_lists2
PDF
sorted_listmatch
PDF
PDF
PDF
hash_tables
PDF
PDF
quick_sort
binary_trees4
binary_trees3
binary_trees2
binary_trees1
algorithm_analysis2
algorithm_analysis1
recursion3
recursion2
recursion1
linked_lists4
linked_lists3
Linked_lists2
sorted_listmatch
hash_tables
quick_sort

Recently uploaded (20)

PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
PDF
Race Reva University – Shaping Future Leaders in Artificial Intelligence
PDF
My India Quiz Book_20210205121199924.pdf
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PDF
Mucosal Drug Delivery system_NDDS_BPHARMACY__SEM VII_PCI.pdf
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
advance database management system book.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Hazard Identification & Risk Assessment .pdf
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
FORM 1 BIOLOGY MIND MAPS and their schemes
Environmental Education MCQ BD2EE - Share Source.pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
Race Reva University – Shaping Future Leaders in Artificial Intelligence
My India Quiz Book_20210205121199924.pdf
Unit 4 Computer Architecture Multicore Processor.pptx
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
Introduction to pro and eukaryotes and differences.pptx
Core Concepts of Personalized Learning and Virtual Learning Environments
Mucosal Drug Delivery system_NDDS_BPHARMACY__SEM VII_PCI.pdf
Journal of Dental Science - UDMY (2021).pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
advance database management system book.pdf
What if we spent less time fighting change, and more time building what’s rig...
Hazard Identification & Risk Assessment .pdf
Uderstanding digital marketing and marketing stratergie for engaging the digi...

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