Question: Write a lisp function called FIND - MAX - LOCATION that looks through a 2 - dimensional 5 x 5 array of numbers and returns

Write a lisp function called FIND-MAX-LOCATION that looks through a 2-dimensional 5x5 array of numbers and returns the LOCATION of the largest value in the array, in row-major-order. So, for an array like the following:
01001
02200
30147
01200
12103
FIND-MAX-LOCATION would return the matrix location as a list of two values: (24). That is, the i,j coordinates of the number 7 in the example.
You will find it useful to review how to use LET to create local variables, and how to make doubly-nested LOOPs.
Here are some lisp expresions that create 2-d arrays for you to test:
(make-array '(55) :initial-contents '((01001)(02200)(30147)(01200)(12103)))
(make-array '(55) :initial-contents '((-71-3-21)(1-252-4)(8-8107)(912-11)(52126))) ;; should return (30)
NOTE: You should call the function as so: (find-max-location a) where "a" is the variable that holds your 2-d array.

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 Programming Questions!