Applications of Depth-First
Depth-first search of undirected Graphs
Biconnectivity: A connected undirected
graph is biconnected if there no vertices
whose removal disconnects the rest of the
After lists (including stacks and queues) and hash tables, trees represent one of the most widely used
data structures. On one hand trees can be used to represent objects that are recursive in nature
(including programming, logical, and arithmetic e
Universitetet i Oslo
Institutt for Informatikk
D. Karabeg, I. Yu
INF2220: algorithms and data structures
Topic: Balanced trees (Exercises with hints for solution)
Issued: 26. 08. 2014
Exercise 1 (Nodes in a binary tree)
1. Show that in
Network Flow Problems
We have a directed graph G = (V,E) with edge
We have two vertices: s, the source, and t is the
sink. Through any edge, (v,w), at most cv,w units of
flow may pass.
At any vertex, v, that is not either s or t, the t
The Disjoint Set ADT
How to solve the equivalence problem
How to optimize the algorithm
A simple application
A relation R is defined on a set S if for every pair
of elements (a,b), a,bS, a R b is either true or
false. If a
Priority Queues (Heaps)
A data structure that at least supports two
operations: insert and deleteMin. deleteMin
finds, returns, and removes the minimum
element in the priority queue.
1. Linked list
2. Sorted linked list
The input is a weighted graph: associated with each
edge(vi,vj) is a cost ci,j to traverse the edge.
The cost of a path (weighted path length) v1,v2,vn is in1 c
Single-source shortest-path problem: given as input a
T ( N ) O ( f ( N ) if there are positive constants c and n0 such that
T ( N ) cf ( N ) when N n0 .
T ( N ) ( f ( N ) if there are positive constants c and n0 such that
T ( N ) cf ( N ) when N n0 .
T ( N ) ( f (
Stack and Queue
A stack is a list with the restriction that
insertions and deletions are performed on
only one position, namely, the end of the
list, called top.
Fundamental operations on a stack: push,
top, and pop.
Stacks are also known a
AVL Trees, Splay Trees, B-Trees
An AVL tree is a binary search tree with a
balance condition: the height of the left and
right subtrees can differ by at most 1.
1. An insertion into the left subtre
An array of some fixed size, containing the items.
A hash table runs from 0 to TableSize 1.
A search is performed on some part of each item
called key. Each key is mapped into some number
in the range 0 to TableSize 1 and placed in t
Data Structures and Algorithm
Analysis Using Java
Whats the course about
What are the possible different ways to solve a
Howre the solutions for a particular problem
What technique is best for a particular problem?
What do we man by
Due 29 March, 2011
1. Sort the following array by using
a. Select sort
b. Insert sort
c. Bubble sort
and trace their execution
2. How many comparisons would it take with bubble sort on an array of 50 item