Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Warm-up Assignment You are given R red marbles and B blue marbles. Your task is to arrange the R + B marbles in a line such that certain restrictions are satisfied (see below). You print all possible arrangements under the given restrictions, and the total count of arrangements possible. Part 1 In this part, the restriction is that no two red marbles may be placed consecutively. Write a single recursive function to print the arrangements and return the count of possibilities. Do not use any global or static variables. Place the available marbles one by one in an array of size R + B. When u red and v blue marbles are placed, find out the options (red and/or blue) at the (u + v + 1)-st position. For each available option, recursively compute the acceptable configurations with u + v + 1 marbles placed in the array. Part 2 In this part, two red marbles may appear in consecutive positions, but three or more red marbles are not allowed to come consecutively. Write a second recursive function following the same line of programming logic as in Part 1. Sample output Enter number of red marbles (R) : 2 Enter number of blue marbles (B) : 4 Part 1 rbrbbb rbbrbb rbbbrb rbbbbr brbrbb brbbrb brbbbr bbrbrb bbrbbr bbbrbr Total number of possibilities is 10 Part 2 rrbbbb rbrbbb rbbrbb rbbbrb rbbbbr brrbbb brbrbb brbbrb brbbbr bbrrbb bbrbrb bbrbbr bbbrrb bbbrbr bbbbrr Total number of possibilities is 15

Attachment:- 1549312_2_warmup.zip

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91760113

Have any Question?


Related Questions in Computer Engineering

The strfirstname and strlastname variables contain the

The strFirstName and strLastName variables contain the strings "Jane" and "Jones", respectively. Which of the following statements will display a string as "Jones, Jane" (the last name, a comma, a space, and the first na ...

Questionif a string is stored at the memory address 0 times

Question: If a string is stored at the memory address 0 times 20008000 and the string is "Cortex-M", show the memory content in hex format starting at 0 times 20008000. How many bytes does this string take in the memory? ...

What is the supply curve how do you apply the law of supply

What is the supply curve, how do you apply the law of supply in economics?

Can you give me short cut of using excel word access share

Can you give me short cut of using excel, word, access, share point, and powerpoint microsoft, I am always have to rely on the back and forth, fleepng the pages, it is possible

Research the web for an example of a startup using a cloud

Research the Web for an example of a startup using a cloud infrastructure. What were the main reasons for choosing a cloud infrastructure? What alternatives did the startup have? Answer should be at least 1 page long dou ...

Stuck in the mud is a popular dice game in uk the game uses

Stuck in the mud is a popular dice game in UK. The game uses five (5) 6-sided dice to play. The players play in turns. Choose one player to start the game. The player will roll all five (5) dice. If the player rolled any ...

Question suppose that we want to create a divide and

Question : Suppose that we want to create a divide and conquer matrix multiplication algorithm for square matrices. Assuming that n is a power of three, the algorithm divides each matrix of A, D, and C into nine equi-siz ...

We might consider a regression of the number of group

We might consider a regression of the number of group members and the efficiency of project completion. Which of those would be the dependent and which would be the independent variables?

Research parallel computing and prepare an informal paper 2

Research parallel computing and prepare an informal paper 2 -3 pages in length, single spaced with a blank line beltween paragraphs. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

Explain that our ability to secure each computers stored

Explain that our ability to secure each computers stored information is now influenced by the security on each computer to which it is connected

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As