Software reviews and inspections in Software Engineering - Time & Space Complexity
When we look at software reviews and inspections, we want to understand how the time needed grows as the size of the software or documents increases.
We ask: How does the effort change when reviewing more code or documents?
Analyze the time complexity of the following review process.
function reviewDocuments(documents) {
for (let doc of documents) {
for (let line of doc.lines) {
checkLine(line);
}
}
}
function checkLine(line) {
// simple checks on the line
}
This code simulates reviewing each line of multiple documents one by one.
Look at what repeats in this review process.
- Primary operation: Checking each line in every document.
- How many times: Once for every line in all documents combined.
As the number of documents or lines grows, the total checks grow too.
| Input Size (n lines) | Approx. Operations |
|---|---|
| 10 | 10 checks |
| 100 | 100 checks |
| 1000 | 1000 checks |
Pattern observation: The total work grows directly with the number of lines to review.
Time Complexity: O(n)
This means the time needed grows in a straight line with the number of lines to review.
[X] Wrong: "Reviewing twice as many lines only takes a little more time."
[OK] Correct: Actually, if you double the lines, you roughly double the time because each line needs checking.
Understanding how review time grows helps you plan and communicate realistic schedules in real projects.
"What if the review process included pair reviews where two people check each line together? How would the time complexity change?"