Order of the nested mappings in the flatmap

Assignment Help Basic Statistics
Reference no: EM131042042

Louis Reasoner is having a terrible time doing exercise 2.42. His queens procedure seems to work, but it runs extremely slowly. (Louis never does manage to wait long enough for it to solve even the 6× 6 case.) When Louis asks Eva Lu Ator for help, she points out that he has interchanged the order of the nested mappings in the flatmap, writing it a

1962_kk.jpg

Explain why this interchange makes the program run slowly. Estimate how long it will take Louis's program to solve the eight-queens puzzle, assuming that the program in exercise 2.42 solves the puzzle in time T.

exercise 2.42 Figure 2.8. A solution to the eight-queens puzzle. The ``eight-queens puzzle'' asks how to place eight queens on a chessboard so that no queen is in check from any other (i.e., no two queens are in the same row, column, or diagonal). One possible solution is shown in figure 2.8. One way to solve the puzzle is to work across the board, placing a queen in each column. Once we have placed k - 1 queens, we must place the kth queen in a position where it does not check any of the queens already on the board. We can formulate this approach recursively: Assume that we have already generated the sequence of all possible ways to place k - 1 queens in the first k - 1 columns of the board. For each of these ways, generate an extended set of positions by placing a queen in each row of the kth column. Now filter these, keeping only the positions for which the queen in the kth column is safe with respect to the other queens. This produces the sequence of all ways to place k queens in the first k columns. By continuing this process, we will produce not only one solution, but all solutions to the puzzle. We implement this solution as a procedure queens, which returns a sequence of all solutions to the problem of placing n queens on an n× n chessboard. Queens has an internal procedure queen-cols that returns the sequence of all ways to place queens in the first k columns of the board.

Reference no: EM131042042

Questions Cloud

Instances of a general splitting operation : Right-split and up-split can be expressed as instances of a general splitting operation. Define a procedure split with the property that evaluating (define right-split (split beside below)) (define up-split (split below beside)) produces procedure..
Can detect an achilles heel in the argument of new atheists : A one page paper answering the question, ""Can you detect an Achilles' heel in the argument of the New Atheists? If so, identify it and if not, state why you have come to that conclusion." I have attached the readings for the paper, it is only a c..
Calculate the expected value-variance : Calculate the expected value, the variance, and the standard deviation of the given random variable X. (Round your answers to two decimal places.) Thirty-seven darts are thrown at a dartboard. The probability of hitting a bull's-eye is.1. Let X be..
Determine the return on the stock market : Determine the return on the stock market over your school term based on the percentage change in the S&P 500 index level over the term
Order of the nested mappings in the flatmap : Louis Reasoner is having a terrible time doing exercise 2.42. His queens procedure seems to work, but it runs extremely slowly. (Louis never does manage to wait long enough for it to solve even the 6× 6 case.) When Louis asks Eva Lu Ator for help,..
Probability that if nine balls are randomly selected : Consider an urn that contains 40 balls. Of these 20 are red, 10 are green, and the remaining are blue. What is the probability that if nine balls are randomly selected from the urn then exactly three are of each color?
Predict the sales price of a sports car : In order to predict the sales price of a sports car, several factors are being investigated. These factors include the speed at ¼ mile (mph), horsepower, and curb weight (in lbs). The data is provided below. You should be able to copy and paste th..
Implement this solution as a procedure queens : Figure 2.8. A solution to the eight-queens puzzle. The ``eight-queens puzzle&; asks how to place eight queens on a chessboard so that no queen is in check from any other (i.e., no two queens are in the same row, column, or diagonal). One possible ..
Discuss description as a part of the interpretive process : Discuss Description as a part of the interpretive process. Why is it important?

Reviews

Write a Review

Basic Statistics Questions & Answers

  Find probability that witnesses would pick same person

the line up contained 5 men. if the identifications were made by ramdom guesses, find the probability thatall witnesses would pick the same person.

  Compute degrees of freedom of a suitable t-statistic

To test H0: against the alternative H1: in Q 1.5 above, the degrees of freedom of a suitable t-statistic is: In a study of the effect of oral contraceptives (OCs) on blood pressure, measurements were made on 10 OC users (x) and 14 non-users (y).

  Assume that a practitioner decides to use a control chart

assume that a practitioner decides to use a control chart wtih a 2.5-sigma limits. if normality can be assumed as

  Suppose you were given the task of estimating the

suppose you were given the task of estimating the proportion of drivers in troy al who text while they drive. discuss

  Part aanswer all of these questions using r commander

part aanswer all of these questions using r commander. include all graphs outputs from r commander .this assignment

  I a days catch showed that 1977 percent of the shrimps

the global fisherypacks shrimps that weigh more than 1.91 ounces each in packages marked largeand the shrimp that

  The t84 calculator

The T84 calculator? Shaquille O'Neal is a professional basketball star who had a reputation for being a poor free throw shooter. As of this writing, he made 5155 of the 9762 free throw that he attempted,

  Using decision tree approach, determine dean optimal stratgy

Materials are expected to cost an average of $1,000 per participant. The dean estimates that she will have to pay total faculty salaries of either &180,000 or $220,000.

  Probability-number of women in executive positions

Affirmative action commitments by industrial organizations have led to an increase in the number of women in executive positions. Satellite Office Systems has vacancies for two executives that it will fill from among four women and six men.

  A standard 6-faced die is rolled twice in an experiment let

a standard 6-faced die is rolled twice in an experiment. let a and b be the outcome of the 1stnbspand 2ndnbsprolls

  Mama stuffin is a popular food item during the fall

Mama's Stuffin' is a popular food item during the fall and winter months, but it is marginal in the spring and summer. Use the following demand forecasts and costs to determine which of the following production planning strategies is best for M..

  Why is the probability of getting two red balls when

the applet below simulates sampling from an urn containing n balls. the total number of balls in the urn the number of

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