0
0
Software Engineeringknowledge~5 mins

Requirements elicitation techniques in Software Engineering - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Requirements elicitation techniques
O(n * m)
Understanding Time Complexity

When gathering requirements, the time it takes to collect and understand user needs can vary greatly.

We want to see how the effort grows as the number of stakeholders or requirements increases.

Scenario Under Consideration

Analyze the time complexity of this simple requirements gathering process.

def gather_requirements(stakeholders):
    requirements = []
    for person in stakeholders:
        for question in person.questions:
            answer = ask(question)
            requirements.append(answer)
    return requirements

This code collects answers to questions from each stakeholder to build a list of requirements.

Identify Repeating Operations

Look at the loops that repeat work:

  • Primary operation: Asking questions to stakeholders.
  • How many times: For each stakeholder, it asks all their questions.
How Execution Grows With Input

As the number of stakeholders or questions grows, the total questions asked grows too.

Input Size (stakeholders x questions)Approx. Operations (questions asked)
10 stakeholders x 5 questions50
100 stakeholders x 5 questions500
1000 stakeholders x 5 questions5000

Pattern observation: The total work grows directly with the number of questions asked.

Final Time Complexity

Time Complexity: O(n * m)

This means the time grows proportionally to the number of stakeholders times the number of questions per stakeholder.

Common Mistake

[X] Wrong: "The time only depends on the number of stakeholders, not questions."

[OK] Correct: Each stakeholder can have many questions, so total time depends on both factors multiplied.

Interview Connect

Understanding how effort scales with more users or questions helps you plan and communicate project timelines clearly.

Self-Check

"What if we only asked a fixed number of questions regardless of stakeholders? How would the time complexity change?"