p.339 9.11
Find the maximum flow in the network of Figure 9.79.
p.339 9.15
a. Find a minimum spanning tree for the graph in Figure 9.82 using both Prim's and Kruskal's algorithms.
b. Is this minimum s
p.88 3.21
Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used.
p.88 3.26
A "deque" is a data structur
p.88
3.21
Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used.
#ifndef _Stack_h #define _Stack_h stru
p.280
8.7
A formatted version
We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another. Is it possible to
p.212 6.2
a. Show the result of inserting 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13, and 2, one at a time, into an initially empty binary heap.
b. Show the result of using the linear-time algorit
p.212
6.2
a. Show the result of inserting 10, 12, 1, 14, 6, 5, 8, 15, 3, 9, 7, 4, 11, 13, and 2, one at a time, into an initially empty binary heap. b. Show the result of using the linear-time algorit
p.257 7.4
Show the result of running Shellsort on the input 9, 8, 7, 6, 5, 4, 3, 2, 1 using the increments cfw_1, 3, 7.
p.258 7.14
How would you implement mergesort without using recursion?
p.258 7.20
p.257
7.4
Show the result of running Shellsort on the input 9, 8, 7, 6, 5, 4, 3, 2, 1 using the increments cfw_1, 3, 7. Answer
Original After 7-sort After 3-sort After 1-sort 9 2 2 1 8 1 1 2 7 7 4 3 6
p.280 8.7 A formatted version
We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another. Is it possible to
p.339
9.11
Find the maximum flow in the network of Figure 9.79. Answer:
A 1 s 6 4 2 G 4 3 D 0 0 H 4 I 2 3 E 0
2
B
2 2
C 0 3 0 F
4 3 t 4
p.339
9.15
a. Find a minimum spanning tree for the graph in Figu
Project 1:
Binary Search Trees
This project requires you to implement operations on unbalanced binary search trees, AVL trees, and splay trees. You are to analyze and compare the performances of a seq
Project 2:
Electric Wiring
Bill is designing electric wiring for his new house. First of all, he has fixed the positions of several electrical outlets on the walls. To neatly connect any pair of outle
Project 3:
Review of Programming Contest Rules
The ACM ICPC's rule of scoring is as the following: A problem is solved when it is accepted by the judges. Teams are ranked according to the most problem
p.172
5.1
Given input cfw_4371, 1323, 6173, 4199, 4344, 9679, 1989 and a hash function h(X) = X (mod 10), show the resulting: a. Separate chaining hash table. b. Open addressing hash table using linea
p.172 5.1
Given input cfw_4371, 1323, 6173, 4199, 4344, 9679, 1989 and a hash function h(X) = X (mod 10), show the resulting:
a. Separate chaining hash table.
b. Open addressing hash table using lin
4.5 Splay Trees Target : Any M consecutive tree operations
starting from an empty tree take at most O(M log N) time.
But o a single operation might S if one node takes O(N) time SThe we can is that on
CHAPTER
5
PRIORITY QUEUES (HEAPS) delete the element with the highest \ lowest priority
5.6 Leftist Heaps
1. Structure Property: A structural property, an ordering property H Definition R the null pat
CHAPTER
9
Introduction NP-Completeness
Graph Algorithms
9.7 Introduction NP-Completeness The Euler circuit problem :find a path that touches every edge exactly once Time is Linear. The Hamiltonian cyc
3 Dynamic Programming
Use a table instead of recursion 1. Fibonacci Numbers: F(N) = F(N 1) + F(N 2)
int Fib( int N ) cfw_ if ( N <= 1 ) return 1; else return Fib( N - 1 ) + Fib( N - 2 );
T( N ) T ( N
CHAPTER
10
ALGORITHM DESIGN TECHNIQUES
10.1 Greedy Algorithms
Optimization Problems: Given a set of constrains and an optimization function. Solutions that satisfy the constrains are called feasible
CHAPTER
11
Amortized Analysis mSplay tree vs. AVL tree; skew heap vs. leftist heap
Target : Any M consecutive operations take at
most O(M log N) time. - Amortized time bound
worst-case bound
amortize
p.85 3.6
Write a function to add two polynomials. Do not destroy the input. Use a linked list implementation.
If the polynomials have M and N terms, respectively, what is the time complexity of your
p.85 3.6 Write a function to add two polynomials. Do not destroy the input. Use a linked list implementation. If the polynomials have M and N terms, respectively, what is the time complexity of your p
p.141 4.16
Show the result of inserting 2, 1, 4, 5, 9, 3, 6, 7 into an initially empty AVL tree.
p.141 4.22
Write the functions to perform the double rotation without the inefficiency of doing two sin
p.141
4.16
Show the result of inserting 2, 1, 4, 5, 9, 3, 6, 7 into an initially empty AVL tree.
4 2 1 3 5 7 6 9
p.141 4.22 Write the functions to perform the double rotation without the inefficiency
p.141 4.23
Show the result of accessing the keys 3, 9, 1, 5 in order in the splay tree in Figure 4.61.
Figure 4.61:
_10_
/ \
_4_ 11
/ \ \
2 6 12
/ \ / \ \
1 3 5 8 13
/ \
7 9
p.143 4.36
a. Sho
p.141
4.23
Show the result of accessing the keys 3, 9, 1, 5 in order in the splay tree in Figure 4.61. Figure 4.61
10
4 2 1 3 5 7 6 8
11 12 13
9
Result for 3:
3 2 1 4 6 5 7 8 9
10 11 12 13
Result for