Consider the new version of DFS. This traverses paths until all non-circular paths from the source to the destination have been found, and returns the shortest one.Let A be the source node, and B be the destination in KN. How many paths of length 2 exist from A to B?______
查看答案
For questions 3 and 4, consider the general case of our previous problem (permutations of n students in a line). Give your answer in terms of n.When represented as a tree, each node will have how many children?______
Given two permutations, what is the maximum number of swaps it will take to reach one from the other?______
For questions 1 and 2, consider our previous problem (permutations of 3 students in a line).When represented as a tree, each node will have how many children?______
Students in a lineSecond graders are lining up to go to their next class, but must be ordered alphabetically before they can leave. The teacher only swaps the positions of two students that are next to each other in line.If we want to represent this situation as a graph, which variables should be represented as edges and vertices?
A) Vertices represent permutations of the students in line. Edges connect two permutations if one can be made into the other by swapping two adjacent students.
B) Vertices represent students. Edges connect two students if they are next to each other in line.
C) Vertices represent permutations of the students, and each edge represents an individual student. An edge connects two vertices if that student is involved in swap between the two permutations.