Question: Write a function subsequences (1st) that consumes ist which is a list of distinct values. The function returns a list of all the subsequences of
Write a function subsequences (1st) that consumes ist which is a list of distinct values. The function returns a list of all the subsequences of Ist. A subsequence is obtained from a given list by selecting elements from the list and placing them in the order in which they occur in it. For example, (1,3,4) is a subsequence of [0,1,2,5,3,6,4,B] while (3,1,4] is not a subsequence (since 1 occurs before 3 in the list). Samples: subsequences (10, True, "wow" 1) => 111, 101, True], [0, True], ['wow'. 10. 'wow'), True, 'wow'), 10, True, 'wow'] subsequences (0) -> 101 subsequences ([379171) => 111, [3791711 Notes: The elements of the subsequences themselves (ie the elements of the outer returned list) can be in any order. For example, for the third sample above, your function may return [137917), 11 instead. . You must solve this problem using accumulative recursion. Moreover, all recursion must be accumulative
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
