Bird
Raised Fist0
Software Engineeringknowledge~5 mins

Risk analysis (probability and impact) in Software Engineering - Time & Space Complexity

Choose your learning style10 modes available
Time Complexity: Risk analysis (probability and impact)
O(n)
Understanding Time Complexity

When analyzing risk, we want to understand how likely a problem is and how big its effect could be.

We ask: How does the chance and impact of risks grow as we consider more factors?

Scenario Under Consideration

Analyze the time complexity of the following risk scoring process.


risks = [ ... ]  # list of risk items
for risk in risks:
    probability = risk.getProbability()
    impact = risk.getImpact()
    riskScore = probability * impact
    recordRiskScore(risk, riskScore)
    

This code calculates a risk score for each risk by multiplying its probability and impact.

Identify Repeating Operations

Look for repeated actions that take time.

  • Primary operation: Looping through each risk item once.
  • How many times: Once per risk, so as many times as there are risks.
How Execution Grows With Input

As the number of risks increases, the work grows in a simple way.

Input Size (n)Approx. Operations
1010 calculations
100100 calculations
10001000 calculations

Pattern observation: The work grows directly with the number of risks.

Final Time Complexity

Time Complexity: O(n)

This means the time to calculate risk scores grows in a straight line as the number of risks grows.

Common Mistake

[X] Wrong: "Calculating risk scores takes the same time no matter how many risks there are."

[OK] Correct: Each risk needs its own calculation, so more risks mean more work.

Interview Connect

Understanding how risk calculations scale helps you explain how your code handles growing data clearly and confidently.

Self-Check

"What if we had to compare every risk with every other risk? How would the time complexity change?"

Practice

(1/5)
1. What does risk analysis in software engineering primarily combine?
easy
A. The programming language and the software framework
B. The cost of the project and the team size
C. The number of developers and the project deadline
D. The likelihood of a problem and its potential impact

Solution

  1. Step 1: Understand risk analysis components

    Risk analysis involves assessing how likely a problem is and how severe its consequences could be.
  2. Step 2: Identify what is combined

    The two main factors combined are probability (likelihood) and impact (severity).
  3. Final Answer:

    The likelihood of a problem and its potential impact -> Option D
  4. Quick Check:

    Risk = Probability x Impact [OK]
Hint: Risk = chance of problem x how bad it is [OK]
Common Mistakes:
  • Confusing risk with project cost
  • Mixing team size with risk factors
  • Thinking risk depends on programming language
2. Which formula correctly calculates the risk score in risk analysis?
easy
A. Risk score = Probability - Impact
B. Risk score = Probability + Impact
C. Risk score = Probability x Impact
D. Risk score = Impact รท Probability

Solution

  1. Step 1: Recall risk score calculation

    The risk score is calculated by multiplying the probability of an event by its impact.
  2. Step 2: Evaluate each formula

    Addition, subtraction, or division do not correctly represent risk score calculation.
  3. Final Answer:

    Risk score = Probability x Impact -> Option C
  4. Quick Check:

    Risk score uses multiplication [OK]
Hint: Multiply chance and impact for risk score [OK]
Common Mistakes:
  • Adding probability and impact instead of multiplying
  • Dividing impact by probability
  • Subtracting values instead of combining
3. Given a risk with probability 0.3 and impact 8, what is the risk score?
medium
A. 8.3
B. 2.4
C. 0.375
D. 24

Solution

  1. Step 1: Identify given values

    Probability = 0.3, Impact = 8.
  2. Step 2: Calculate risk score by multiplying

    Risk score = 0.3 x 8 = 2.4.
  3. Final Answer:

    2.4 -> Option B
  4. Quick Check:

    0.3 x 8 = 2.4 [OK]
Hint: Multiply probability and impact numbers [OK]
Common Mistakes:
  • Adding instead of multiplying
  • Multiplying in reverse order but miscalculating
  • Confusing decimal multiplication
4. A project manager calculates risk score as Probability + Impact instead of Probability x Impact. What is the main error?
medium
A. Using addition instead of multiplication for risk score
B. Ignoring the impact value
C. Using probability as a percentage
D. Calculating risk score twice

Solution

  1. Step 1: Identify the calculation mistake

    The manager added probability and impact instead of multiplying them.
  2. Step 2: Understand correct risk score formula

    Risk score must be calculated by multiplying probability and impact to reflect combined effect.
  3. Final Answer:

    Using addition instead of multiplication for risk score -> Option A
  4. Quick Check:

    Risk score = Probability x Impact, not addition [OK]
Hint: Risk score needs multiplication, not addition [OK]
Common Mistakes:
  • Adding values instead of multiplying
  • Forgetting to include impact
  • Misinterpreting probability scale
5. A software project has three risks with these values: Risk A (0.2, 10), Risk B (0.5, 3), Risk C (0.1, 15). Which risk should be prioritized based on risk score?
hard
A. Risk A
B. Risk B
C. Risk C
D. All have equal priority

Solution

  1. Step 1: Calculate risk scores for each risk

    Risk A: 0.2 x 10 = 2.0
    Risk B: 0.5 x 3 = 1.5
    Risk C: 0.1 x 15 = 1.5
  2. Step 2: Compare risk scores to prioritize

    Risk A has the highest score of 2.0.
  3. Final Answer:

    Risk A -> Option A
  4. Quick Check:

    Risk A score = 2.0 > others [OK]
Hint: Pick risk with highest score [OK]
Common Mistakes:
  • Choosing risk with highest probability only
  • Choosing risk with highest impact only
  • Assuming all risks have equal priority
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard