How do you add all the values that return by all the
threads from threadpools?
I have created a threadpool with 1000 of threads and run the task
1000 times. However, when I try to print out the result it gives a
whole bunch of values that return by all the threads, it looks
like...
Thread-1 xxxx
Thread-2 xxxx
Thread-3 xxxx
Thread-4 xxxx
.
.
.
.
.
Is there a possible way to get a single value back instead of whole bunch of value? Taking the average value of all the threads are fine as well.
This question is based on Java only. Thank you!!
In: Computer Science
How can i calculate this?
A file of size F = 8 Gbits needs to be distributed to10 peers. Suppose the server has an upload rate of u = 68 Mbps, and that the 10 peers have upload rates of: u1 = 20 Mbps, u2 = 22 Mbps, u3 = 12 Mbps, u4 = 19 Mbps, u5 = 25 Mbps, u6 = 24 Mbps, u7 = 18 Mbps, u8 = 11 Mbps, u9 = 14 Mbps, u10 = 30 Mbps, and download rates of: d1 = 28 Mbps, d2 = 30 Mbps, d3 = 12 Mbps, d4 = 20 Mbps, d5 = 18 Mbps, d6 = 15 Mbps, d7 = 14 Mbps, d8 = 34 Mbps, d9 = 20 Mbps, d10 = 34 Mbps. What is the minimum time needed to distribute this file from the central server to the 10 peers using the client-server model (round to the nearest second)?
In: Computer Science
How to write this mini program in C# - (C sharp please)
There are 3 squirrels and winter begins in roughly 12 weeks
Each week, a squirrel will manage to stash away anywhere
from 10 to 20 acorns
Each week, display the following:
◦
The number of weeks before winter
◦
The number of acorns each squirrel stashed away that week
◦
The total number of acorns each squirrel has stashed away
Bonus: display the number of acorns stashed each month as
asterisks (*)
In: Computer Science
In: Computer Science
Write an interactive program that inputs a decimal num1 and an
integer num2. If num1 is less than num2, then it displays "num 1 is
less than num 2"; if they are identical, it starts over again; if .
If num2 is less than num1, then it displays "num 2 is less than num
1
In: Computer Science
2. Consider these declarations: ArrayList stringList = new ArrayList(); String ch = “ ”; Integer intOb = new Integer(5);
For the following statements, indicate VALID or INVALID (invalid if the statement causes an error)
A. strList.add(ch); _______________
B. strList.add(new String(“handy andy”); ______________
C. strList.add(intOb.toString()); ____________
D. strList.add(ch + 8); _________________
E. strList.add(intOb + 8); ____________
In: Computer Science
#4 You need to write a class MinMax with a method minmax that takes an array of integers as a parameter and returns min and max simultaneously (using one method and one call). (java oop)-> laboratory work
In: Computer Science
Draw a UDP segment, identify its header fields, and provide a brief description for each one of them
In: Computer Science
A perceptron with a unipolar step function has two inputs with weights w1= 0.5 and w2= -0.2, and a threshold theta=0.3 (theta can therefore be considered as a weight for an extra input which is always set to -1). The perceptron is trained using the learning rule ∆w = η (d − y) x, where x is the input vector, η is the learning rate, w is the weight vector, d is the desired output, and y is the actual output.What are the new values of the weights and threshold after one step of training with the input vector x = [0, 1]^T and desired output 1, using a learning rate η = 0.5?
In: Computer Science
Im working with visual basics for these problem.
1) Write a program that accepts five integers, and for each integer following the first, prints "GREATER" or "LESS" depending on whether or not the current integer is greater than the previous one. At the end, your application will let user know the largest and the smallest of the five numbers provided
(BONUS): consider using the concepts of swapping the current and previous values as needed and don't use 5 variables.
In: Computer Science
to be written in c++ only
Objectives
To be able to solve problem using branch an bound strategy
To be able to find the minimized cost
To practice writing solutions to problems in a clear and succinct
way
Problem
Let there be N workers and N jobs. Any worker can be assigned to
perform any job, incurring
some cost that may vary depending on the work-job assignment. It is
required to perform all jobs
by assigning exactly one worker to each job and exactly one job to
each agent in such a way that
the total cost of the assignment is minimized. Write a program
using branch and bound strategy to
show who will be assigned which job and the total cost
incurred.
In: Computer Science
: In the context of state diagrams in system design, describe what is an event, state, transition and conditions?
In: Computer Science
Describe an algorithm that could be used to solve the Tee Puzzle. In this puzzle, the board consists of a 5 sided triangle full of golf tees. One hole is empty. You can jump a tee over an adjacent tee as long as it lands into an empty hole. The jumped tee is removed. The goal is to have one tee remaining.
In: Computer Science
[BushQ2] Consider the typical file structure of the C: (Windows) or / (Linux and macOS) drives. How is the hierarchy of this structure reflective of the permissions granted to various users within the system? Explain.
In: Computer Science
Q2: What are the forms of malware? Differentiate briefly between them. Give example for each.?
Q4: what are the similarities and differences of the two types of protocols TCP and UDP?
In: Computer Science