To program using the functional programming paradigm

Assignment Help Data Structure & Algorithms
Reference no: EM13333263

Objective:

• To program using the functional programming paradigm.

Assignment:

Write the following functions using Scheme (or LISP if you prefer):

1. A function (binomial N k) that returns the binomial coefficients C(N, k), defined recursively as: C(N,0) = 1, C(N, N) = 1, and, for 0<k < N, C(N, k) = C(N-1, k) + C(N - 1, k -1).
2. A function (mod N M) that returns the modulus remainder when dividing N by M.
3. A function (binaryToDecimal b) that takes a binary number and returns its decimal value. (binaryToDecimal 1101) returns 13.
4. A function (addBinary binaryList) that takes a list of binary numbers and returns their decimal sum. (addBinary '(1101 111 10 101)) returns 27
5. A function (min list) that returns the smallest value in a simple list of integers.
6. A function (myRemove atm list) that removes all occurrences of the atom atm from a simple list, returning list with atm removed. myRemove should return the original list if atm is not found.
7. A function (selectionSort list) that returns a simple list of integers in ascending order using a recursive selection sort algorithm. Hint: use your min function.
All the functions must be written in a functional style and must use only the basic LISP functions car, cdr, cons, null, atom, the equality functions, the arithmetic functions, and the append function.

Reference no: EM13333263

Questions Cloud

How much force is pushing the cart in the forward direction : a shopper pushes a grocery cart by exerting a force on the handle. if the force equal 76 N at an angle of 40.0 degrees below the horizontal, how much force is pushing the cart in the forward direction
Explain why long-distance phone service was orginally : For many years, AT&T was a regulated monopoly, providing both local and long-distance telephone service.Explain why long-distance phone service was orginally a natural monopoly.
What is the lenght of the electrons angular momentum vector : An electron is in an angular momentum state with l=3, What is the lenght of the electron's angular momentum vector
Evaluate the ph of an koh solution : Calculate the pH of an KOH solution if 56.4 mL of KOH soultion is titrated with a 0.875 M HCl and it took 15.6 mL of the HCl to reach the equivalence point.
To program using the functional programming paradigm : A function (addBinary binaryList) that takes a list of binary numbers and returns their decimal sum. (addBinary '(1101 111 10 101)) returns 27.
Evaluate direct labor cost and manufacturing overhead : What are the equivalent units for conversion costs for the month in the first processing department and the allocation of Becky's wages and fringe benefits for the week between direct labor cost and manufacturing overhead would be
Determine the friction force acting on the block : A 2.90-kg block starts from rest at the top of a 30.0° incline and slides a distance of 2.10 m down the incline in 1.20 s. Find the friction force acting on the block
Define what is the percent yield of the product : For the reaction: Rb2SO3(s) + 2HBr(aq) --> 2RbBr(s) + H2SO3 A solid sample of Rb2SO3 weighing 6.24 g reacts with 1.38 L of gaseous HBr, measured at 75°C and 0.953 atm pressure
Find the magnitude of the total gravitational force : Four 8.5 kg spheres are located at the corners of a square of side 0.80 m. Calculate the magnitude and direction of the total gravitational force

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Mst (minimum spanning tree)

A graph has distinct edge weights. Does its lightest edge have to belong to the MST (Minimum Spanning Tree)? Can its heaviest edge belong to the MST?

  Create algorithm to read file of employee records

Create the algorithm which will read the file of employee records and produce the weekly report of gross earnings for those employees.

  Creating relational database about music performers

Create a relational database having information about music performers, their recordings, and the composers of the music they recorded.

  Develop a flowchart and provide a brief explanation

Create a hierarchy chart depicting the chosen situation and develop a flowchart and provide a brief explanation for it.

  Discuss the business problem

Provide a clear statement of the aims and objectives of the data analytics study and the possible outcomes in terms of discovered knowledge and its potential application towards solution of the problem. In this section you need to discuss the busi..

  Find maximum possible amount of money by optimal strategy

Removes it from row permanently, and receives value of coin. Find out the maximum possible amount of money we can definitely win if we move first.

  Write an algorithm to count nodes in a linked list

storage pool and that there is a special null value. Write an algorithm to count the nodes in a linked list with first node pointed to by first."

  Calculate a three quarter moving average forecast

The Fastgro Fertilizer Corporation distributes fertilizer to various lawn and garden shops. Calculate a three-quarter moving average forecast for quarters 4 through 13 and calculate the forecast for each quarter.

  What is the best algorithm for sorting

What is the best algorithm for sorting each of the following: general comparable objects, long character strings, double precision floating point numbers, 32-bit integers, and bytes? Justify your answer.

  Write algorithm to prompt for and accept four numbers

Write the algorithm which will prompt for and accept four numbers, sort them into ascending sequence and display them to screen. Your algorithm is to include module called Order _two_numbers.

  Propose an efficient data structure

Propose an efficient data structure that may hold the tour operator's data using a normalization process. Describe each step of the process that will enable you to have a 2nd Normal Form data structure.

  Binary search algorithm

Use the binary search algorithm to seach the list. (You might need to modify the algorithm given in this chapter to count the number of comparisons.)

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd