Saturday, October 27, 2012

Find All subsubsequence of size r in given array of length n

2 comments :

Anonymous said...

Your solution does not find sub-arrays of size r. It finds all sub-sequences of size r. Sub-arrays are contiguous, which sub-sequences are not.

Given an array of size 3 there can be n-r+1 such sub-arrays.

n=3, r=2, A = [1, 2, 3]
all possible subarrays of size r = {[1,2], [2,3]}

Unknown said...

@anon , thanks for correcting , i have updated it , keep it up !!!