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

  Question about unix commands

Assume you have a document called records.txt having the list of employee id and workers names. Every line contains a single employee id immediately followed by the employee name in the format Last name, First name.

  Write a program flowchart

Write a program FLOWCHART that lets the user enter a sequence of numbers. The program should stop when it notices that the last two numbers entered were identical.

  Determining public keys for other party in sending message

Determine correct public keys for other party, and assuming that Eve can intercept any messages.

  Display the dfs starting from a specified vertex

Design and implement a driver to show the following (check for 2 graphs; 1 is provided, including the starting vertex):Display the dfs starting from a specified vertex;Display the discovery/finishing time for each node in the graph;Show the Parenthes..

  Determinethe assymtotic complexity

Determinethe assymtotic complexity (Big Theta) int terms of n (not sum) for the following code fragment in the average case.

  Describe how algorithm works for adjacency matrix

All vertices according to their type (head, neck, shoulder, hip, front foot or rear foot). Note that as adjacency matrix has n2 entries, you can't scan entire matrix in O(n) time. Describe how algorithm works.

  Develop a sequential flow diagram

Develop a sequential flow diagram and a sequential VI in LabVIEW that illustrates how to solve the following problem, and provides a correct solution.

  Auditing focuses on failures

Under normal situations, auditing focuses on failures to access rather than successful accesses. Explain why it might be a good concept to audit successful access to documents in a directory that contains highly confidential documents.

  Polynomial time algorithm for rooted directed acyclic graphs

Illustrate that if you were given a polynomial time algorithm for determining whether two rooted directed acyclic graphs are isomorphic, then polynomial time algorithm for testing.

  What is the time complexity of running quicksort

Consider your textbook's implementation of quicksort from chapter 8. The corrected findPartition method is included below for your convenience.

  Model of online music sharing

Since Napster is going out of business, you have decided to begin your own on line music sharing site. You will give individual music documents at your site.

  Creating an effective physical design

Class, do IT database designers necessary to understand data volumes and number of users of database in order to create an effective physical design?

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