Question: a. Write a recursive LISP function that will reverse the elements of a list. (Do not use the built-in reverse function.) What is the complexity

a. Write a recursive LISP function that will reverse the elements of a list. (Do not use the built-in reverse function.) What is the complexity of your implementation? It is possible to reverse a list in linear time; can you do so?

b. Write a LISP function that will take a list nested to any depth and print the mirror image of that list. For instance, the function should have the behavior:

> (mirror ’((a

b) (c (d e))))

(((e

d) c) (b a))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Management And Artificial Intelligence Questions!