The third homework includes Using CLISP and recursion reimpl

The third homework includes: Using CLISP and recursion, re-implement the 2^nd program in homework 1 create a list or an array of random integers (e.g., between [0. 50]) and a target number (e. g., 60). then find all subsets of the integers of the list/array such that the numbers in each subsets add up to the target number Note that besides printing the numbers of each subset, you also need to print the original indices of the numbers For example given array A = {5, 3, 4, 2, 6, 7}, target = 9, the number pairs are (5. 4), (3, 6), (2, 7), and (3, 4, 2). Their indices are (0, 2), (1, 4), (3, 5), and (1, 2, 3), respectively Compare the difference between sorting array and sorting list in Lisp.

Solution

On top of what was already said about arrays vs lists, there isn\'t such thing as \"fastest\" sort algorithm. This ultimately depends on what data are you sorting. Some algorithms will perform better on collections containing similar values, while others will perform better on collections that contain nearly sorted values.

In practice, there may be other complications, like, additional conses created during sorting or additional memory allocated during array sorting. Something that would necessitate a call to GC, which might absolutely turn over the tides.

Whenever you have a particular practical problem that requires sorting, you need to consider the circumstances and what kind of data you will be dealing with. For example, sorting of Z-vertices in a 3-dimensional space while rendering animations would probably most benefit from an algorithm that operates on linked lists and nearly sorted data, sorting of the meteorological research data will likely benefit from an algorithm that deals best with previously unsorted mostly unique data. Some particular software can do vectorized insertion sorting which will be many times faster then any single value per operation algorithm, and so on.

Sorting a collection of random numbers is usually a poor indicator of how your code will perform on actual data.

 The third homework includes: Using CLISP and recursion, re-implement the 2^nd program in homework 1 create a list or an array of random integers (e.g., between

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site