subject

Uluthando needs your help to plant some trees. He can give you three parameters of the land: - width of the land w - length of the land l - gap between the trees g You have to create an algorithm to return the number of trees which can be planted on the edges of the given land in a symmetrical layout shown below (unsymmetrical gap = x, tree = o, gap = -): w=3, l=3, g=1 plantTrees(w, l, g) ➞ 4 o - o - - o - o // Uluthando can plant 4 trees. w=3, l=3, g=3 plantTrees(w, l, g) ➞ 2 o - - - - - - o // Uluthando can plant 2 trees. If the layout is not symmetrical, you have to return 0: w=3, l=3, g=2 plantTrees(w, l, g) ➞ 0 o - - x o x x x // Planting 2 trees mean the gap of two trees will be greater than 2. o - - x o o - - // Planting 3 trees mean the gap of two trees will be less than 2. Another Example for better understanding: w=3, l=3, g=0 plantTrees(w, l, g) ➞ 8 o o o o o o o o // Uluthando can plant 8 trees. ​

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:40
Amain idea is supported, explained, or expanded on with a numbers b. a concluding statement c. details d. a topic sentence. im e paragraphs reset nex next
Answers: 2
question
Computers and Technology, 22.06.2019 06:30
What result from the passage of this amendment
Answers: 1
question
Computers and Technology, 23.06.2019 00:40
Consider the following statements: struct nametype{string first; string last; }; struct coursetype{string name; int callnum; int credits; char grade; }; struct studenttype{nametype name; double gpa; coursetype course; }; studenttype student; studenttype classlist[100]; coursetype course; nametype name; mark the following statements as valid or invalid. if a statement is invalid, explain why.a.) student.course.callnum = "csc230"; b.) cin > > student.name; c.) classlist[0] = name; d.) classlist[1].gpa = 3.45; e.) name = classlist[15].name; f.) student.name = name; g.) cout < < classlist[10] < < endl; h.) for (int j = 0; j < 100; j++)classlist[j].name = name; i.) classlist.course.credits = 3; j.) course = studenttype.course;
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
You know the right answer?
Uluthando needs your help to plant some trees. He can give you three parameters of the land: - width...
Questions
question
Biology, 18.04.2021 17:40
Questions on the website: 13722362