CS 308 Data Structures
Spring 2003  Dr. George Bebis
Midterm
Duration: 1:00  2:15 pm
Name:
1. True/False (5 pts each) To get credit, you must give brief reasons for your answers !
(1.1) T F An objective way to compare two algorithms is by comparing thei
CS302 Data Structures
Spring 2012 Dr. George Bebis
Midterm Exam Study Guide
C+ review material (Sections 2.22.4, 3.3, 4.2 and my slides)
Function call by value or reference
Pointers and dynamic array allocation.
Differences between static and dynamic arr
Image Representation and Manipulation
CS302 Data Structures
Prof. George Bebis
http:/www.cse.unr.edu/CVL
How are images represented?
8 bits/pixel
0
255
Color images
A Simple model of image formation
The scene is illuminated
by a single source.
The scene
CS302 Data Structures
Dr. George Bebis
Spring 2012
General Information
Instructor: Dr. George Bebis
Ofce: 235 SEM
Phone: 7846463
Email: [email protected]
Office Hours: TR 2:30pm  3:45pm or by appointment
Course Web Page: http:/www.cse.unr.edu/beb
Inheritance
CS 302 Data Structures
Section 2.4 (pp. 294298) and Section 6.7
Inheritance hierarchy  example
Concepts at higher levels are more general
Concepts at lower levels are more specific (i.e.,
inherit properties of concepts at higher levels)
A
Heaps
CS 302 Data Structures
Sections 8.8, 9.1, and 9.2
Full Binary Tree
Every nonleaf node has two children
Leaves are on the same level
Full Binary Tree
Complete Binary Tree
(1) A binary tree that is either full or full through
the nexttolast leve
Hashing
Sections 10.2 10.3
CS 302
Dr. George Bebis
The Search Problem
Uns o rte d lis t
O (N)
S o rte d lis t
O (lo g N) u s in g a rra ys (i.e .,b in a rys e a rc h )
O (N) us ing linke d lis ts
Bina ryS e a rc h tre e
O (lo g N) (i.e .,b a la n
Graphs
CS 302 Data Structures
Section 9.3
What is a graph?
A data structure that consists of a set of nodes
(vertices) and a set of edges between the vertices.
The set of edges describes relationships among the
vertices.
1
2
3
4
Applications
Schedules
Co
Computer Vision
CS302 Data Structures
Dr. George Bebis
http:/www.cse.unr.edu/CVL
What is Computer Vision?
Making computers see and understand
Nice
sunset!
Connections to other disciplines
Artificial Intelligence
Pattern Recognition
Robotics
Machine Learni
Short C+ Review
CS 302 Data Structures
Call by value/reference
Formal Parameters
The argument names in the function header are
referred to as formal parameters.
int FindMax(int x, int y)
cfw_
int maximum;
if(x>=y)
maximum = x;
else
maximum = y;
return ma
C+ Review
CS 302 Data Structures
Review Topics
Calling functions by value or reference
Pointers and reference variables
Static and dynamic arrays
Constructors, destructors and copyconstructors
Operator overloading
Functions
Section 2.2
Two ways to c
Binary Search Trees
CS 302 Data Structures
Chapter 8
What is a binary tree?
Property 1: each node can have up to two
successor nodes.
What is a binary tree? (cont.)
Property 2: a unique path exists from the
root to every other node
Not a valid binary tr
Programming Assignment 1
CS302 Data Structures
Goals
Improve your skills with manipulating dynamic arrays.
Improve your understanding of constructors, destructors,
and copyconstructors.
Improve your skills with operator overloading.
Familiarize yours
Analysis of Algorithms
CS 302  Data Structures
Section 2.6
Analysis of Algorithms
What is the goal?
Analyze time requirements  predict how
running time increases as the size of the
problem increases:
time = f(size)
Why is it useful?
To compare differe
Data Structures and Algorithms
Timing a function
Most systems seem to have implementations of the ANSI C routine clock(). You can find its specifications with the
man 3 clock
command. Each call of clock() returns the time in ticks since the last call. So,
Sorting in O(N) time
CS302
Data Structures
Section 10.4
1
How Fast Can We Sort?
Selection Sort, Bubble Sort, Insertion Sort:
Heap Sort, Merge sort:
Quicksort:
O(n2)
O(nlgn)
O(nlgn)average
What is common to all these algorithms?
Make comparisons betwe
MultidimensionalSearch
Trees
CS 302 Data Structures
Dr. George Bebis
QueryTypes
Exact match query: Asks for the object(s)
whose key matches query key exactly.
Range query: Asks for the objects whose
key lies in a specified query range (interval).
Nearest
Programming Assignment 2
CS 302 Data Structures
Dr. George Bebis
Objective: Use Stacks and Queues
Objective:
to Count and Label Regions
input image
1. Extract regions and count them
2. Assign a distinct graylevel value
to each region (i.e., for visualiza
//[email protected],m
CS 308 Data Structures
Fall 2000  Dr. George Bebis
Final Exam
Duration: 12:00  2:00 pm
Name:
I. True/False (2 pts each) To get credit, you must (very briey) for your answers I!
L L.
(1.1) T69? he maximum number of nodes in a tree that
//[email protected],m
CS 308 Data Structures
Fall 2000  Dr. George Bebis
Final Exam
Duration: 12:00  2:00 pm
Name:
I. True/False (2 pts each) To get credit, you must (very briey) for your answers I!
L L.
(1.1) T69? he maximum number of nodes in a tree that
Programming Assignment 1
CS302 Data Structures
Goals
Improve your skills with manipulating dynamic arrays.
Improve your understanding of constructors, destructors,
and copyconstructors.
Improve your skills with operator overloading.
Familiarize yours
Unsorted Lists
CS 302 Data Structures
Sections 3.1, 3.2, 3.4 & 3.5
Unsorted list
A list in which data items are placed in no
particular order.
Sorted list
A list in which data items are placed in a
particular order.
Key: a member of the class whose valu
Stacks
CS 302 Data Structures
Sections 5.1, 5.2, 6.1, 6.5
Warning
Although data structure concepts between
this and last semesters will be the same,
there might be implementation differences.
Your answers in questions in quizzes and
exams should be base
Sorting
CS302
Data Structures
Section 10.1
1
Sorting means . . .
q
Sorting rearranges the elements into either
ascending or descending order within the
array (well use ascending order).
36
6
24
10
10
12
6
24
12
36
2
Algorithms
Selection Sort
q Bubble Sort
Computer Vision Research @ UNR
Dr. George Bebis
http:/www.cse.unr.edu/CVL
Computer Vision Laboratory (CVL)
Sponsors:
CVL was founded in 1998 to
conduct basic and applied
research in computer vision.
Members
 2 faculty
 7 PhD students
 2 MS students

RedBlack Trees
CS302 Data Structures
Dr. George Bebis
RedBlack Trees
Binary search tree with an additional attribute for
its nodes: c o lo r which can be red or black
Constrains the way nodes can be colored on any
path from the root to a leaf.
Balance
Recursion
CS 302 Data Structures
Chapter 7
What is recursion?
A technique that solves problem by solving
smaller versions of the same problem!
smaller
When you turn this into a program, you end
up with functions that call themselves (i.e.,
recursive fun
Queues
CS 302 Data Structures
Sections 5.3 and 5.4
What is a queue?
It is an ordered group of homogeneous items.
Queues have two ends:
Items are added at one end.
Items are removed from the other end.
FIFO property: First In, First Out
The item adde