CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Sorting Algorithms
Sorting an Array of Integers
Defining a Class for our Sort Methods
Defining a Swap Method
An incorrect Swap Method
A correct Swap Method
Time Analysis
Sorting by Selection: Selection Sort
Selecti

CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Introduction to Data Structures and
Algorithms Queues and Priority Queues
2
Queues
British for line
Somewhat like a stack
Except, first-in-first-out
Thus this is a FIFO structure.
3
Analogy:
Line at the movie

CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Introduction to Data Structures and
Algorithms Simple Sorting
2
Sorting in Databases
Many possibilities
Names in alphabetical order
Students by grade
Customers by zip code
Home sales by price
Cities by popula

CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Introduction to Data Structures and
Algorithms Stacks
2
Usage
Arrays are conducive for databases
Data which will be accessed and modified
Easy operations for insertion, deletion and searching
Although some of t

CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Introduction to Data Structures and
Algorithms Linked Lists
2
Recall Arrays
Advantages
Access is fast O(1)
Insertion is fast in an unordered array O(1)
Searching is fast in an ordered array O(log n)
Because we

CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Introduction to Data Structures and
Algorithms Algorithm Analysis
2
Algorithm Analysis
There are many different algorithms to solve the same
problem
Ask 5 programmers to write a non-trivial program, you will get

CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Introduction to Data Structures and
Algorithms Parsing Arithmetic Expressions
2
Parsing Arithmetic Expressions
A task that must be performed by devices such as
computers and calculators
Parsing is another word fo

1
INTRODUCTION
CSE 201 Data Structures and Algorithms I
2
Welcome to CSE 201 Data Structures and
Algorithms I!
Introductions and Contact Info
Syllabus
Goals of the course
Outline
Start off Chapter 1
3
Information
Instructor: Dr. Hasan Kitapi
Lectur

CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Introduction to Data Structures and
Algorithms
Overview
What are data structures and algorithms?
What good will it do me to know about them?
Why cant I just use arrays and for loops to handle my
data?
When does

CSE 201 DATA STRUCTURES
AND ALGORITHMS I
Introduction to Data Structures and
Algorithms - Arrays
2
The Array
Most commonly used data structure
Common operations
Insertion
Searching
Deletion
How do these differ for an ordered array?
How do these dif