Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Use backtracking to find a subset, if it exists, of the set {27, 24, 19, 14, 11, 8} with sum

a) 20. b) 41. c) 60.

Short Answer

Expert verified
  1. There is not a subset with sum 20 exists.
  2. The subset with sum 41 is {27,14}.
  3. The subset with sum 60 is {27,19,14}.

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

Over 22 million students worldwide already upgrade their learning with Vaia!

01

Find the subset of sum 20.

(a)

Here the given set is {27, 24, 19, 14, 11, 8}.

Let the subset be S.

27 ,24 is not subset s because it is greater than 20.

19 cannot be in subset S, because the given set does not contain \({\bf{20 - 19 = 1}}\).

14 cannot be in subset S, because the given set does not contain \({\bf{20 - 14 = 6}}\).

11 cannot be in subset S, because the given set does not contain \({\bf{20 - 11 = 9}}\). While it contains 8.

8 cannot be in S, because there is no other element in the set that could help to get sum 20.

Thus, there is no solution.

02

Determine the subset of sum 41.

(b)

Let the subset S.

Let add the first element 27 to S. \({\bf{S = }}\left\{ {{\bf{27}}} \right\}\).

24 cannot be in S, because \({\bf{27 + 24 = 51}}\), greater than 41.

19 cannot be in S, because \({\bf{27 + 19 = 46}}\), greater than 41.

Add 14 to S. the \({\bf{27 + 14 = 41}}\).

So, the subset is \({\bf{S = }}\left\{ {{\bf{27,14}}} \right\}\).

Thus, the subset {27,14} with sum 41.

03

Find the subset of sum 60.

(c)

Let the subset S.

Let add the first element 27 to S. \({\bf{S = }}\left\{ {{\bf{27}}} \right\}\).

24 can be in S, because \({\bf{27 + 24 = 51}}\), then \({\bf{S = }}\left\{ {{\bf{27,24}}} \right\}\). No other number can be added in this set.

19 can be in S, because \({\bf{27 + 19 = 46}}\), So set \({\bf{S = }}\left\{ {{\bf{27,19}}} \right\}\).

Add 14 to S. the \({\bf{46 + 14 = 60}}\).

So, the subset is \({\bf{S = }}\left\{ {{\bf{27,19,14}}} \right\}\).

Thus, the subset {27, 19 ,14} with sum 60.

Therefore, the results are

  1. There is not a subset with sum 20 exists.
  2. The subset with sum 41 is {27,14}.
  3. The subset with sum 60 is {27,19,14}.

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Answer these questions about the rooted tree illustrated.

  1. Which vertex is the root\(?\)
  2. Which vertices are internal\(?\)
  3. Which vertices are leaves\(?\)
  4. Which vertices are children of \({\bf{j}}\)\(?\)
  5. Which vertex is the parent of \({\bf{h}}\)\(?\)
  6. Which vertices are siblings of \({\bf{o}}\)\(?\)
  7. Which vertices are ancestors of \({\bf{m}}\)\(?\)
  8. Which vertices are descendants of \({\bf{b}}\)\(?\)

Draw the subtree of the tree in Exercise \({\bf{3}}\) that is rooted at

\({\bf{a) a}}{\bf{.}}\)

\({\bf{b) c}}{\bf{.}}\)

\({\bf{c) e}}{\bf{.}}\)

In this exercise we will develop an algorithm to find the strong components of a directed graph \({\bf{G = }}\left( {{\bf{V,E}}} \right)\). Recall that a vertex \({\bf{w}} \in {\bf{V}}\) is reachable from a vertex \({\bf{v}} \in {\bf{V}}\) if there is a directed path from v to w.

  1. Explain how to use breadth-first search in the directed graph G to find all the vertices reachable from a vertex \({\bf{v}} \in {\bf{G}}\).
  2. Explain how to use breadth-first search in \({{\bf{G}}^{{\bf{conv}}}}\) to find all the vertices from which a vertex \({\bf{v}} \in {\bf{G}}\) is reachable. (Recall that \({{\bf{G}}^{{\bf{conv}}}}\) is the directed graph obtained from G by reversing the direction of all its edges.)
  3. Explain how to use part (a) and (b) to construct an algorithm that finds the strong components of a directed graph G, and explain why your algorithm is correct.

Show that every tree is a planar graph.

Find a minimum spanning tree of each of these graphs where the degree of each vertex in the spanning tree does not exceed 2.

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free