Hi, I was trying to print all the subarrays of a vector, (Recursively). And in one approach of mine, the recursion was going in some states which it shouldn’t have. Then I wrote a condition (start==end)
which prevented the recursion to go into the states which it goes in another recursive case. Here’s the code link. I cannot justify it to myself why did it stop going into another state or how it helped. Also here’s the code where I did not write the condition and it went onto printing the subarray twice (state) code link.
Also, is the time complexity of this approach is O(2^n)?