Data hosted with ♥ by
Pastebin.com
-
Download Raw
-
See Original
public
class
MainClass
{
public
static
void
main
(
String
[
]
args
)
{
//{parent,child}
String
[
]
[
]
path
=
{
{
"a"
,
"b"
}
,
{
"a"
,
"c"
}
,
{
"b"
,
"d"
}
,
{
"b"
,
"e"
}
,
{
"c"
,
"g"
}
,
{
"g"
,
"h"
}
,
{
"g"
,
"h"
}
}
;
Search s
=
new
Search
(
path
)
;
System
.
out
.
println
(
"Depth-First Seatch"
)
;
s.
DFS
(
"d"
)
;
System
.
out
.
println
(
s.
getProcess
(
)
)
;
System
.
out
.
println
(
)
;
System
.
out
.
println
(
"Breath-First Seatch"
)
;
s.
BFS
(
"d"
)
;
System
.
out
.
println
(
s.
getProcess
(
)
)
;
}
}