Question

In: Computer Science

Show that the number of nodes of both the fixed-tuple and variable-tuple state-space trees for the sum of subsets problem are exponential in n.

The following submission rules apply:

·    For those questions requiring programs, the solutions must be implemented using JavaScript or Java.

o Appropriate self-documenting comments in the source code are mandatory, consistent with good programming practices.

o Solutions must be provided in plain text so that formatting is not lost.

·    All answers must be provided in this document.

·    Sources must be given accurate and complete citations sufficient for the instructor to find and confirm them.

Show that the number of nodes of both the fixed-tuple and variable-tuple state-space trees for the sum of subsets problem are exponential in n.

Solutions

Expert Solution

Suppose we find the maximum element in both of the roughly n sized partitions of an n-element n>=1 list. Then in order to find the maximum element of the entire list we simply need to see which of the two maximum elements is the larger, and which of the two minimums is the smaller. We assume that in a1-element list the sole element is both the maximum and the minimum element.

procedure maxmin (L[0...n-1] of numbers) ->(max)

begin

      if(n = = 0)

        return (L[0])

     else if (n = = 1)

       if( L[0] < L[1])

              return (L[1])

        else

              return (L[0])

end

Let be the number of comparisons performed by the maxmin procedure. When n = 0 clearly there are no comparisons. Thus we have T(0) = 0. Similarly, T(1) = 1. Otherwise when n > 1clearly

          T(n) = 2T(n)+1

Since maxmin performs one recursive calls on partitions of roughly the total size of the list and then makes two further comparisons to sort out the max for the entire list.


Related Solutions

By constructing a suitable bijection, show that the number of subsets of an n-set of odd...
By constructing a suitable bijection, show that the number of subsets of an n-set of odd size is equal to the number of subsets of an n-set of even size.
Bonus Problem: Find the number of spanning trees in Km,n. Note: I need how to get...
Bonus Problem: Find the number of spanning trees in Km,n. Note: I need how to get the right formula-not just oh this is the formula you need.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT