Data Structures and Algorithms (CS 130A)
Prof. Suri
Homework Assignment 1
Handed Out: Jan 6 Due: Jan 13
1. (10 pts) Suppose T1 (n) = O(g (n) and also T2 (n) = O(g (n). Which of the following are true? Explain your answer. (a) (b) (c) (d) T1 (n) + T2 (n) =

CS-130A
'
Graphs.1
Biconnectivity
$
Graph G is biconnected if there are no vertices whose removal disconnects the rest of the graph
Biconnected
Not Biconnected
Articulation Points: Vertex in a graph whose removal disconnects the graph into two or more c

CS-130A
'
Heaps.1
$
Max Heaps
Each node stores one value, but the values may be repeated (i.e., it is a multiset, rather than a set). Complete binary tree (All possible nodes at each level are present except possibly for the last level. All the missing n

'
$
CS-130A
Hashing.1
Hashing
Table (hd) with D (or T ableSize) entries or b (buckets).
Hash function f (x) maps keys to cfw_0, 1, 2, . . . , D 1, i.e., the
universe is partitioned into D regions by the hash function.
In the ideal situation the objects

$
'
CS-130A
RBTrees.1
Deletion Transformation
Transform the problem of Deletion to
the problem of deletion of a node with
two Null Pointers.
2 Null Children
Done
1 Null Child
Delete
Right:
Left:
Delete
&
%
'
$
CS-130A
RBTrees.2
Deletion Transformation
0

'
$
CS-130A
Trie.1
Tries (reTRIEval)
A TRIE represents strings over some alphabet
prexes.
by its tree of
Each node in a TRIE is represented by a boolean variable and
a vector of length m, where m is the number of elements in .
A function, normally comp

CS-130A
Sorting1
Bin Sort
Sorting integers in Range [1, . . . , n]
Add all elements to table and then
Retrieve in order 1, 2, 3, . . . , n
Stable Sorting Method (repeated elements
will end up in their original order)
Bin
Bin
1
Numbers
2
3
Add them to

CS-130A
Graphs (Basic).1
GRAPHS
Introduced by Euler 1736, Koeingsberg bridge
problem (EAST PRUSSIA)
c
A
a
C
d
g
D
e
b
f
B
Problem: Starting at some land area, is it
possible to walk across all the bridges exactly
once returning to the starting land are

CS-130A
Union-Find1
Disjoint Set Union
HUGE number of other applications.
Union(merge): Union of two sets
Find: Find set where elements belongs
Universe U=cfw_1,2,.,n
1
10 11
3
2
7
6
4
8
9
5
Circled number is name of set
Find(j): nd set to which j b

9/28/16
CMPSC 130A: Data Structures & Algorithms
IntroducBon
Divy Agrawal
Department of Computer Science
University of California at Santa Barbara
(Adapted from CMPSC 130A Lecture Notes by Professor Subhash Suri)
Prex Average Problem
Algorithm I:

9/26/16
CMPSC 130A: Data Structures & Algorithms
IntroducAon
Divy Agrawal
Department of Computer Science
University of California at Santa Barbara
(Adapted from CMPSC 130A Lecture Notes by Professor Subhash Suri)
MoAvaAng ApplicaAons
Imagine you

9/29/16
CMPSC 130A: Data Structures & Algorithms
Heaps
Divy Agrawal
Department of Computer Science
University of California at Santa Barbara
(Adapted from CMPSC 130A Lecture Notes by Professor Subhash Suri &
Ambuj Singh)
Pefect Binary Tree
A binar

'
CS-130B
$
Time and Space Complexity.1
Program Performance
Performance: Amount of memory and time to
run a program.
Space Complexity: amount of memory needed
to run a program. Why important?
Running in multiuser environment
Is there enough memory?
S

CMPSC 130A: Winter 2011
Programming Assignment 2
Assigned: Feb 17, 2011
Due: Mar 1, 2011 (11:59 PM)
Your second programming assignment is to implement the splay trees. Recall that splay trees
are balanced search trees in which no explicit balance conditio

Data Structures and Algorithms (CS 130A)
Prof. Suri
Homework Assignment 3
Handed Out: Feb 10 Due: Feb 17
1. (20 pts) Consider the leftist heap shown below. (a) Show the new heap that results when a deleteMin is performed. Show the intermediate steps. (b)

Data Structures and Algorithms (CS 130A)
Prof. Suri
Homework Assignment 4
Handed Out: March 1 Due: March 8
1. (10 pts) Consider the following B-Tree, where the branching factor is t = 2. Suppose we insert the keys Y, F, X , and Z (in that order) into this

CMPSC 130A: Winter 2011 Programming Assignment 1 Assigned: Jan 27 Due: Feb 8 (11:59 PM)
Hashing is useful if we are only interested in insert, delete, and nd operations; e.g., delete (10) or insert (5) or nd (100). But a hash table provides no assistance

CS130 A: Data S tructure and Algorithm s s
Focus of thecourse : Data structure a s nd re d algorithm late s C orre ss and (tim and space com xity ctne e ) ple s Pre quisite re s C 20: stacks, que s, lists, binary se S ue arch tre s, e C 40: functions, re

Cour se Outl i ne
s C+
Revi ew (Ch. 1) s Al gor i thm Anal ysi s (Ch. 2) s Sets wi th i nser t/ del ete/ member : H ashi ng (Ch. 5) s Sets i n gener al : Bal anced sear ch tr ees (Ch. 4, 12.2) s Sets wi th pr i or i ty: H eaps, pr i or i ty queues (Ch. 6)

Course Outline
s s s s s s s s
Abstract data types and algorithm analysis (Ch. 2, 3) C+ review (Ch. 1) Sets in general: Balanced search trees (Ch. 4 and 12.2) Sets with insert/delete/member: Hashing (Ch. 5) Sets with priority: Heaps, priority queues (Ch.

CS 140 Assignment 2: Matrix-Vector Multiplication and the Power Method
Assigned January 10, 2011 Due by 11:59 pm Wednesday, January 19
This assignment is to write a parallel program to multiply a matrix by a vector, and to use this routine in an implement

CS294-5: Great Algorithms
April 17, 2006
Professor: Richard Karp
Scribe: Vinod Prabhakaran
Notes for Lecture 23
In this lecture we analyze the splay tree algorithm presented in the last
lecture. Splay tree algorithm is an elegant algorithm for maintaining

The Birthday Problem or Paradox
Let us assume that a person's birthday falls on any day of the year with equal
probability (chance). In other words, there is no inherent bias for one day
versus another. (In practice may not be strictly true, but close e

B-Trees. [Cormen-Leiserson-Rivest]
1. Search trees designed to minimize IO operations to secondary memory.
When database is too large to fit in main memory, some parts will be
stored in disk. A single access to disk can be 10^3 to 10^5 times
slower t

SUGGESTIONS FOR WRITING HOMEWORK SOLUTIONS
1. WHAT to write:
1a. An algorithm's solution has 3 parts:
description of the algorithm
correctness justification
complexity analysis
In some cases, one or more of these parts may take just 1 sentence,
bu

Syllabus and Schedule
TOPIC Handout Due
Jan
4 Intro, Analysis, Max subsequence
6 Max Subsequence, Worst-case analysis Ex 1
11 Bi-Oh notation, Asymptotics
13 Sets ADT, lists, queues Ex 1 DUE
18 Hash functions, and Hashing
20 Heaps, and d-heap

Search Trees.
1. Trees useful structure for hierarchical information, searching, etc.
With large data, repeated linear search in link list too slow.
With appropriate binary search trees, we can do searches, inserts,
deletes, find successor, find pred