forked from zhuxiuwei/CLRS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
第22章 图基本算法 | ||
= | ||
##22.1 图的表示 | ||
#####22.1-1 Given an adjacency-list representation of a directed graph, how long does it take to compute the out-degree of every vertex? How long does it take to compute the in-degrees? | ||
G=(V,E)。 | ||
out-degree:O(V+E) | ||
in-degree:O(V+E) | ||
|
||
#####22.1-2 Give an adjacency-list representation for a complete binary tree on 7 vertices. Give an equivalent adjacency-matrix representation. Assume that vertices are numbered from 1 to 7 as in a binary heap. | ||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | ||
:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---: | ||
1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | ||
2 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | ||
3 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | ||
4 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | ||
5 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | ||
6 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | ||
7 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | ||
|
||
### 22.1-3 |