b. (10 points) Define a recursive function reverse in Scheme which accepts only an S-list s as an argument and reverses the elements of s in linear time (i.e., time directly proportional to the size of s), O(n). You may use only define, lambda, let, cond, null?, cons, car, and cdr in reverse. You may not use append or letrec in your solution. Examples: Welcome to DrRacket, version 7.5 [3m) Language: racket, with debugging, memory limit: 128 MB CPS 352 - Assignment 2 by Your Name > (reverse (1 2 3 4 5)) (5 4 3 2 1) > (reverse (1)) (1) > (reverse (21) ) (1 2) > (reverse (night and day)) (day and night) > (reverse (1 02 (3)) (45)) ) ((4 5) (2 (3)) 1) c. (10 points) Define a recursive function flatten in Scheme which accepts only an s-list (i.e., a list, possibly nested to an arbitrary depth) as an argument and returns it flattened as a list of atoms. Examples: Welcome to DrRacket, version 7.5 (3m). Language: racket, with debugging, memory limit: 128 MB. CPS 352 - Assignment 2 by Your Name > (flatten'()) O > (flatten (O)) () > (flatten '((())) () > (flatten' (a b c d)) (a b c d) > (flatten' (a (b) 0 ( 0) 0 d ((e)))) (a b c d e) > (flatten (((a b)) (c) () d ((le) () (()))))) (a b c d e f) > (flatten (a (b c) (((d)) (e)) (f g(h)))) '(a b c d e f g h) b. (10 points) Define a recursive function reverse in Scheme which accepts only an S-list s as an argument and reverses the elements of s in linear time (i.e., time directly proportional to the size of s), O(n). You may use only define, lambda, let, cond, null?, cons, car, and cdr in reverse. You may not use append or letrec in your solution. Examples: Welcome to DrRacket, version 7.5 [3m) Language: racket, with debugging, memory limit: 128 MB CPS 352 - Assignment 2 by Your Name > (reverse (1 2 3 4 5)) (5 4 3 2 1) > (reverse (1)) (1) > (reverse (21) ) (1 2) > (reverse (night and day)) (day and night) > (reverse (1 02 (3)) (45)) ) ((4 5) (2 (3)) 1) c. (10 points) Define a recursive function flatten in Scheme which accepts only an s-list (i.e., a list, possibly nested to an arbitrary depth) as an argument and returns it flattened as a list of atoms. Examples: Welcome to DrRacket, version 7.5 (3m). Language: racket, with debugging, memory limit: 128 MB. CPS 352 - Assignment 2 by Your Name > (flatten'()) O > (flatten (O)) () > (flatten '((())) () > (flatten' (a b c d)) (a b c d) > (flatten' (a (b) 0 ( 0) 0 d ((e)))) (a b c d e) > (flatten (((a b)) (c) () d ((le) () (()))))) (a b c d e f) > (flatten (a (b c) (((d)) (e)) (f g(h)))) '(a b c d e f g h)