Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (10 points) Write a Scheme function that computes the volume of a sphere, given its radius. 2. (12 points) Write a Scheme function

1. (10 points) Write a Scheme function that computes the volume of a sphere, given its radius. 2. (12 points)

1. (10 points) Write a Scheme function that computes the volume of a sphere, given its radius. 2. (12 points) Write a Scheme function that takes two numeric parameters, a and b, and returns a raised to the b power. Use the following recursive relation: ab - {x- = b=0 axa- b>0 3. (13 points) Write a Scheme function that takes a list as a parameter and returns a list identical to the parameter except the last element has been deleted. 4. (10 points) Write a CLISP function that returns the number of zeros in a given simple list of numbers. 5. (10 points) Repeat question 4 for ML. 6. (10 points) Write a Scheme function that returns the reverse of its simple list parameter. 7. (15 points) Write a CLISP function that gets the three coefficients of a quadratic equation ax + bx + c =0 as input parameters and returns the greater root. Note: assume that pre-condition is b > 4ac 8. (20 points) Quick Sort is a sub-quadratic sorting algorithm that inputs a list of comparable objects, picks an element from the list as the "pivot", partitions the list into two separate sub-lists (values less than pivot and values greater than pivot), and finally does this procedure recursively for each sub-list. The following function implements quick sort in F#: let rec qsort:int list -> int list = function 10 -> 0 |x::xs -> let smaller = [for a in xs do if a x then yield b] qsort smaller @ [x] @ qsort larger a. (2 points) Identify the base case of this recursive function. b. (3 points) Which element of the input list is considered to be the pivot in each recursive call? c. (8 points) Write the input list of every recursive call to qsort function when we want to sort the list of integers [5; 3; 7; 1; 10] d. (7 points) Manipulate this function so that it sort a given list in decreasing order.

Step by Step Solution

3.36 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

It seems there is an image with a list of programming questions mainly related to functional programming languages such as Scheme CLISP ML and F You a... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Programming Languages

Authors: Robert Sebesta

11th Edition

013394302X, 978-0133943023

More Books

Students also viewed these Programming questions

Question

Are the unions of F# discriminated?

Answered: 1 week ago