Question: Write two Lisp functions inspired from memory allocation methods that will be discussed in class. Both functions take two parameters: a list containing numbers and

 Write two Lisp functions inspired from memory allocation methods that will

Write two Lisp functions inspired from memory allocation methods that will be discussed in class. Both functions take two parameters: a list containing numbers and a simple value that we can assume to be a number. Both functions should return nil if they don't find what they are looking for. a. The first function should be called first-fit and it should return the first element in the list that is larger than or equal to the value. For example, (first-fit '(3 8 6 4 9) 5) should return 8. b.(*A3) The second should be called best-fit and it should return the element of the list that best fits the value. For this, you have to look for the smallest value in the list that is larger than or equal to the value. Do not use the built-in function sort, nor sort the list in some other way. The solution should be linear and sorting is worse than linear. For example, (best-fit '(3 8 6 4 9) 5) should return 6

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