I am trying to write a recursive function to check whether one array is contained in a second array (my example is also sub-array) and returns true or false.
For example: [d, e] is contained in [a, b, c, d, e, f]
.
I know how to check without recursion (using for loops), but can not think of a solution using recursion.
You can use hashing to store elements of large array in hash table and then check whether each element of sub array is there in hash table or not, If all elements found then it will be subarray.