A mother has children of varying ages in need of t-shirts. The mother has to distribute t-shirts with the following requirements:
Each child should get at least one t-shirt. A child with an age higher than adjacent children should get more t-shirts than them. How should the mother distribute such that total number of t-shirts is minimized?
2.Create a class box, each box has an int ID, and an east and west side, these are represented as Booleans, all of these are randomly assigned true or false. If true you can pass through that side. These are ONE WAY doors. If false it is a wall. Create a ROW of 8 random boxes. Determine which box has the maximum reachability. Use : to represent a door and a | to represent a wall in your display, example follows:
|0| :1|:2:|3:|4||5::6: |7: Box 0 you can go no where Box 1 you can visit 0 ((box 1 has a West door)) Box 2 you can visit 1 and 0 AND 3 and 4 Box 3 you can visit 4 Box 4 you can go no where Box 5 you can visit 6 and 7 Box 6 you can visit 5 and 7 Box 7 you can go no where The box with maximum reachability is box 2 where you can reach 0,1,3,4
1.Generate N>10 random values from 1 to 100 using a uniform probability distribution. N is entered by the user. The first 5 values are put into nodes and added to a priority queue based on their value. Each node also contains a list of values. After the first 5 are inserted into the priority queue the rest of the values are added to the lists with the initial node being the delimiter as the maximum value. This defines an interval from the previous node to that value. The range for the first value is 1 to is value Display the contents of the Priority Queue as below:
For example if the values were 5, 55, 22, 14, 98, 23, 99, 40, 7, 55, 25, 9, 66
The PQueue would have interval nodes 5, 14, 22, 55, 98 the entire contents would be
Node 5 has NO entries Node 14 has values 7, 9 (( values greater than 5 but <= 14)) Node 22 has NO values Node 55 has value 23, 55 Node 98 has value 66
The value 99 does not appear since it does fall within any of the intervals
6.Create a class Fact. Each Fact has an integer ID. Ever Fact also has a list of Fact pointers. Ask the user for an integer N which is the number of Facts to be generated. After all of them are generated and added to a list, go back through and add a random number 0 to 5 Fact pointers to EACH of them. This creates a rather complex mesh of Facts. Display your mesh, then choose one of them at random and display all reachable facts. Do not report loops. For example
If the user enters N = 8
And the following Facts are created randomly: #1 -> 2, 5 #2 -> none #3 -> 4, 5, 7 #4 ->3, 6 #5 ->7 #6 ->1 #7 ->2
IF #4 is chosen the result would be #4 ->3, 6, 5, 7, 1, 2
since 4 connects to 3 and 6 3 connects to 4 , 5, 7 6 connects to 1 5 connects to 7 7 connects to 2 1 connects to 2, 5 2 connects to none
IF #1 is chosen The result would be #1 ->2, 5, 7
Since 1 connects to 2, 5 2->none 5 connects to 7 7 connects to 2
3.Create a class node that contains a random value -50<x<50, Create a 2-d array (size m, n entered by the user ) of these random nodes find the internal square with the largest sum of values within it. For example if the user enters m = 4, and n=3 and values are generated it might look like this
-324-168 -2 5-2211 5-10312 335-17-33
You might think the maximum sub-matrix would be -25 5-20 335 sum =26
But it is actually 8 11 12 sum =31 you need to check all possible rectangles, this is a 2d version of the greatest common substring problem.
Write a program to convert temperature in Fahrenheit to temperature in Celsius and vice versa according to the user’s preference. The formula for the conversion in one direction is as follows: Tc = (5/9) * (Tf – 32) Check the correctness and allowed scope of the entered data. Let the user enter data from a file and write the conversion next to the initial value. For example, if the user needs to convert F to C, create a file named FtoC.txt with random Fahrenheit values. Read the file from your program and write next to each F value the C conversion. Do this for CtoF as well.