Why is the traversal of a graph different from a tree?
a. There can be a loop in a graph so we must maintain a visited flag for every vertex
b. DFS of a graph uses stack, but in-order traversal of a tree is recursive
c. BFS of a graph uses queue, but a time efficient BFS of a tree is recursive
d. All of the above
a. There can be a loop in a graph so we must maintain a visited flag for every vertex
To avoid running into a never-ending loop, we use a Boolean array of visited vertices.
You might also like to view...
A Web page that looks fine on a tablet is likely to be equally readable on a smartphone.
Answer the following statement true (T) or false (F)
The most common method of encrypting personal information sent over the Web ______________.
Fill in the blank(s) with the appropriate word(s).
The tags are used to create a ____________________ .
Fill in the blank(s) with the appropriate word(s).
Which of the following statements about Swing GUI components is false?
a. Swing components are less portable but more flexible than the original Java GUI components from package java.awt. b. Most Swing components are written completely in Java. c. Swing components allow the user to specify a uniform look-and-feel across all platforms. d. Swing components allow the user to change the look-and-feel while the program is running.