Q 1.
a. sentence aabc can produce more than one derivation tree.
Q 2.
a.
<S> = aaa<T>bb b
<T> = a<T><T>b |
is a type 2 Grammar.
For a Grammar to be type 2 any rule can be of the form A B where A is a
nonterminal and B a string of terminals and/or non-ter
3/27/09
Value Oriented Data Structures
CS200: Balanced Search
Trees
Walls & Mirrors Chapters 12,13
Homework 4 extension
Next week: Programming
quiz during recit
Midterm 2 April 8th (in
class)
New partners and
programming assignment
Table ADT
Manage data a
4/6/09
Graph Terminology
subgraph
CS200: Graphs
A subgraph of a graph G = (V,E)
is a graph (V,E) such that V
is a subset of V and, E is a
subset of E
Graph Traversal
Connected Components
Graph Traversal
An undirected graph is called connected if there is
4/2/09
Graphs
A collection of
nodes and edges
CS200: Graphs
What can this
represent?
A computer
network
Abstraction of
a map
Social network
Rosen Ch. 9.1-9.4, 9.6, 10.4-10.5
Walls and Mirrors Ch. 14
Directed Graphs
A collection of
nodes and
directed ed
Measuring the efficiency of
algorithms
Computational Complexity:
Measuring the Efficiency of
Algorithms
Measuring the efficiency of
algorithms
We have two algorithms: alg1 and alg2 that
solve the same problem. Our application
needs a fast running time.
Ho
Computation Time for Recursive
Algorithms
Recursive Algorithms
Example: Compute the factorial function N!
Divide and Conquer Algorithms,
Complexity Analysis of Recursive
Algorithms
Example: Tower of Hanoi, move all disks to third peg without
ever placing
4/29/09
Trees as Graphs
CS200: Graphs
Tree: an undirected connected graph that
has no cycles.
A
D
F
G
H
I
J
K
L
M
Rooted Trees
C
E
Rosen Ch. 9.1-9.4, 9.6, 10.4-10.5
Walls and Mirrors Ch. 14
B
N
O
P
Trees as Graphs
A rooted tree is a tree in which one vert
Tree Terminology
Binary Trees
root
CS200: Trees
A binary tree is a set T of nodes such that either
Edge
interior node
path
Node
subtree
Walls Ch. 11
Degree?
parent
T is empty, or
T is partitioned into three disjoint subsets:
A single node r, the root
Two
Announcements
Linear, time-ordered structures
Written homework available on assignment
page (due next friday in class).
CS200: Linear Structures
Data structures that reflect a temporal relationship
We will consider:
order of removal based on order of inse
4/24/09
Tuples
CS 200: Relations
An ordered n-tuple is a sequence of n objects
(x1, x2, , xn)
First component is x1
n-th component is xn
Rosen 8.1 8.5
Tuples vs Sets
Two tuples are equal iff they are equal
coodinate-wise
Binary Relations
(x1, x2, , xn) =
Priority Queues
CS200: Priority Queues
and Heaps
Characteristics
Priority Queue Implementation
ArrayList ordered by priority
Binary search tree
pqIsEmpty():boolean
Insert new item
3.
pqInsert(in newItem:PQItemType) throws PQueueException
Retrieve and dele
5/8/09
General
cs200 study guide
Special review session wed. may 13th 1-3pm
at CSB130
Tips on how to study to this exam
For each data structure:
What ADT does it implements
Algorithms for the various operations
Implementations and their properties (big O)
CS200 Written Assignment # 5 Due Monday December 10, 1007 at 11:20AM NO LATE PERIOD
Nearly all significant software development is done as part of a team. For many of you, these assignments will have been your first experience in team programming. Be