-1

Q.1.2 List all the different ways to connect two different objects for the input/output in the table below:

   Input    |    Output    |    Not Output (Connection Already Established)
   3-4           3-4
   4-9           4-9
   8-0           8-0
   2-3           2-3
   5-6           5-6
   2-9                          2-3-4-9
   5-9           5-9
   7-3           7-3
   4-8           4-8
   5-6                          5-6
   0-2                          0-8-4-3-2
   6-1           6-1

A.1.2 (I don't understand this question) How would you answer this? That is you are given a pair, and if the nodes are not connected by other nodes already in the graph it outputs the pair else it does not output the pair because it is already connected based on the data that came before it.

Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
  • I don't understand this question. – Karoly Horvath Aug 16 '11 at 09:25
  • I do not have enough context to answer this question. Is this homework? If so, what lecture/class is this from? What is your current topic. – LiKao Aug 16 '11 at 09:30
  • This is not for a class, as I am not in school. I am going through this book I found in the library, and it is one of the questions in the book. Short of typing out large portions of the chapter, this is what is presented to me in the book. The book's title is Algorithms in C++ by Robert Sedgewick. My issue seems to be the same one you all are having. What the **** is the author asking? I think Ricky is right, but I was not reading the question as a Depth first search. – Matthew Hoggan Aug 16 '11 at 09:43

1 Answers1

0

As you describe it I would say

Your table describes a graph:

3<->4
4<->9
etc...

Now given 2 nodes (2 numbers) you need to find all the path from one to another. I guess you can look at this post for an optimise way to find all the paths : Graph Algorithm To Find All Connections Between Two Arbitrary Vertices

Community
  • 1
  • 1
Ricky Bobby
  • 7,490
  • 7
  • 46
  • 63