{
"metadata": {
"name": "",
"signature": "sha256:0a73ca15645dd5f416851809ef72de1dc22336999041b334779c06ba497368ff"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"22.3-2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
""
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"22.3-3"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$(u$
\n",
" for each vertex
\n",
" $u.$color
\n",
" $u$.$\pi := $ NIL
\n",
"\n",
" time
\n",
" for each
\n",
" if $u.$color == WHITE
\n",
" if MODIFIED-DFS-VISIT(
\n",
" return True
\n",
" return False\n",
"\n",
"\n",
"MODIFIED-DFS-VISIT(
\n",
" time
\n",
" $u$.d
\n",
" $u$.color
\n",
" for each
\n",
" if
\n",
" $v$.$\pi := u$
\n",
" if MODIFIED-DFS-VISIT(
\n",
" return True
\n",
" else
\n",
" return True
\n",
"\n",
" $u$.color
\n",
" $u$.$f := $ time
\n",
" return False
\n",
"\n",
"####Analysis:\n",
"1. Our algorithm visits each node in
\n",
"Hence, the time complexity is
\n",
"\n",
"For example, let
\n",
" let
\n",
" let
\n",
" let root
\n",
" root.low
\n",
" if root has at least
\n",
" output root
\n",
"\n",
"Visit(
\n",
" min
\n",
" for each
\n",
" temp
\n",
" if temp
\n",
" min
\n",
" for each
\n",
" if
\n",
" min
\n",
" $v$.low
\n",
" if
\n",
" output
\n",
" return min\n",
"\n",
"####Analysis:
\n",
"1.
\n",
"2. Our algorithm goes through each node & edge at most twice.
\n",
"Since
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"####h.\n",
"If node
\n",
" use c. to evaluate all nodes' low value
\n",
" for each
\n",
" $v$.bcc :=
\n",
"\n",
"####Analysis:\n",
"1. The algorithm of c. takes
\n",
"2. The for-loop takes
\n",
"Hence, the time complexity is
Created
May 23, 2014 14:37
-
-
Save elsdrium/d6b156b509dfbb835e4c to your computer and use it in GitHub Desktop.
HW10
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment