This Project Prints all the Subarrays of the Array.Input will be given by User i.e.., an Array and Size of Array 'N' using C++ programming language.
This Project print all the subsets of the given array using the recursion concept.
Given an integer array of elements and the size of the array By the User.
Have to print all the Subarrays of the array.
Example :
Input: a = [1,2,3],N=3 Output: [[1],[1,2],[1,2,3],[2],[2,3],[3]]
Approach :
First We Create a recursive function by passing paramaters as given array
we will traverse through out the array using recursion concept we will generate all subarrays
and push back them into a 2D vector which will be the answer.
Note : We are printing the subarrays using recursion concept the time complexity will be,
Time Complexity :O(2^n)
Auxilary Space :O(N)
Submitted by MOHAMMAD JABIR (mdjabir86)
Download packets of source code on Coders Packet
Comments