Skip to content
DeepForgeby svx
All problems
MediumGraph Algorithmsgraph-162

PERT Variance

Problem

Compute PERT variances for a list of activities.

Each activity is [optimistic, likely, pessimistic] and its variance is ((p - o) / 6)^2. Return [variances, total] where variances lists every activity's variance and total is their sum (assuming independent activities).

Hint

The wider the optimistic-pessimistic range, the larger the variance.

Test cases

case 1
in: [[[2,4,6],[3,5,7]]]
expected: [[0.4444444444444444,0.4444444444444444],0.8888888888888888]
case 2
in: [[[2,3,10],[4,4,4]]]
expected: [[1.7777777777777777,0],1.7777777777777777]
case 3
in: [[[1,1,1]]]
expected: [[0],0]
Starter codePython
def pert_variance(activities):
    # Your code here
    pass

3 test cases · run your code against them in the editor