Question: please solve in machine language Exercise 6': Write a function insert that takes as input a number and a sorted list of numbers and outputs
please solve in machine language
Exercise 6': Write a function insert that takes as input a number and a sorted list of numbers and outputs a list with the number inserted into the list at the correct place so that the returned list is still sorted. Do this recursively and use pattern matching. Hint: You need to consider only three cases: the given list is empty, the given number is less than the first element of the list, or the given number is greater than the first element of the list.
Exercise 6'': Use your insert function to write a sort function (a recursive version of "insertion sort"). Hint: To sort a list you insert the first element of the list into the sorted rest of the list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
