Skip to content

⭐ Rated 4.9/5 by 8,400+ students  |  🎓 Expert writers in 80+ subjects  |  ✅ 100% original, no AI  |  🔒 Confidential & secure

Home Blog

Create all the possible combinations of array a – Software Engineering

5 min read

Create all the possible combinations of array a – Software Engineering

The subset-sum problem is defined as follows: given a set B of n positive integers and an integer K, can you find a subset of B whose elements’ summation is equal to K? Design an algorithm to solve this problem. Address its correctness and running time.

📝

Need a custom essay written to your exact brief?

Our PhD-qualified writers craft original, plagiarism-free essays tailored to your topic, word count, citation style, and deadline — argumentative, analytical, descriptive, or reflective. Every paper is 100% written from scratch.

✓ Plagiarism-free  ·  ✓ 100% human-written  ·  ✓ Free revisions  ·  ✓ Confidential

Order My Custom Essay

🔒 No payment to start  ·  From $11/page

Input: set B of n positive integers {b1, b2,….., bn} and an integer K.

Output: whether there exist such a subset of B called B’ its elements summation is equal to K.

✍️

Your thesis deserves more than a rushed draft.

Master's and doctoral thesis writing requires a defensible argument, rigorous methodology, and impeccable academic writing. Our thesis specialists have delivered 8,400+ model documents that passed committee review.

✓ Plagiarism-free  ·  ✓ 100% human-written  ·  ✓ Free revisions  ·  ✓ Confidential

Get Expert Thesis Help

🔒 No payment to start  ·  From $11/page

B’= BA, where A = {a1, a2,…….., an} in which AB= b1a1 +b2a2 +……+ bnan. Where ai is either 0 or 1.

📚

Tight deadline? We've handled tighter.

Our fastest writers turn around quality academic work in 3 hours. Full essay, research paper, case study — delivered before your submission time.

⏰ 3-hour delivery available🔒 100% confidential✅ Plagiarism report included💰 Money-back guarantee
Place My Urgent Order

24/7 support · No hidden fees

Algorithm:
– For i= 1 to 2n (We have 2n different combinations set to be checked)
1. Create all the possible combinations of Array A and do:
– Compute Sum =
– If Sum = K then there is a subset sum to K. This subset B’= {b1a1, b2a2, ……, bnan}when ai representing 1.
– return the subset B’
– Otherwise return there is no subset sum to K.

The run time is O(2n) since it needs to go through all possible subsets to find the subset that sum to K.

Need help with your assignment?

Expert writers available now. Original work, no AI, free revisions.

🔒 No payment to start · Free revisions · Money-back guarantee

4.9 ★

Student rating

8,400+

Papers delivered

97%

On-time delivery

Why students choose Scholaris

  • 100% human writing, no AI
  • Plagiarism report with every order
  • Deadlines from 3 hours
  • Money-back guarantee
  • Free unlimited revisions

Related Study Guides