1. Create a procedure (decreasing L) that takes a list of numbers as input and returns a list of all of the consecutive decreasing subsequences in the input list.
Note: a decreasing subsequence is a sequence of two or more numbers (… ni ni+1 …) such that ni > ni+1.
E.g.,
(decreasing ‘(3 6 8 9 7 4 8 6 3)) → ((9 7 4) (7 4) (8 6 3) (6 3))
(decreasing ‘(7 6 5 4 8 5 2 5 1 5 2 1)) → ((7 6 5 4) (6 5 4) (5 4) (8 5 2) (5 2) (5 1) (5 2 1) (2 1))
(decreasing ‘(1 2 3 3 3 4 5)) → ()
2. Write a function (tree-merge T1 T2) that takes two trees as arguments and merges them according to the following rules:
Merging two trees is done by recursing through their structure and merging their subtrees.
The root of T1 is merged with the root of T2
The first child of T1 is merged with the first child of T2
Second with second… etc, etc, etc, …
Merging two leaf nodes is done by multiplying their values (you may assume they are numbers).
Merging a leaf node with a subtree is done by scaling the subtree by the value of the leaf.
Merging a subtree with an empty tree, is simply the non-empty subtree.
E.g.: