Question
Please help make c++ program following instructions below. The parts to fill out are underlined in link below. https://bsuonline.blackboard.com/bbcswebdav/pid-18027302-dt-content-rid-28660907_1/xid-28660907_1 1. Given a Sorted array A[]
Please help make c++ program following instructions below.
The parts to fill out are underlined in link below.
https://bsuonline.blackboard.com/bbcswebdav/pid-18027302-dt-content-rid-28660907_1/xid-28660907_1
1.
Given a Sorted array A[] consisting of zeros, ones and twos, create c++ program to find the index I, of first '1' in the given array. Your task is to complete the function findFirstIndex() which takes the array A[] and its size N as arguments and returns the index of first 1. If 1 is not present in the array then return -1. Fill out the underlined parts of the function - findFirstIndex().
2.
The subset- sum problem involves determining whether or not a subset from a list of integers can sum to a target value. For example consider the array <1,2,3,4,5>. If the target =7, there are three subsets that achieve this sum:{3,4}, {2,5} and {1,2,4}. If target = 15 there are solutions. Implement the function, int numSubsetSum(), which return an integer value representing the number of different subsets whose sum is equal to the given target sum value. Fill out the underlined parts in the function - numSubsets()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started