Microsoft Copilot for Office tasks in AI for Everyone - Time & Space Complexity
When using Microsoft Copilot for Office tasks, it is important to understand how the time it takes to complete tasks grows as the amount of data or complexity increases.
We want to know how the processing time changes when Copilot handles larger documents or more complex requests.
Analyze the time complexity of this simplified Copilot task processing:
function processDocument(document) {
for (const paragraph of document.paragraphs) {
analyzeText(paragraph.text);
}
generateSummary(document);
}
function analyzeText(text) {
// Analyze each word in the text
for (const word of text.words) {
checkContext(word);
}
}
This code processes each paragraph in a document, analyzes each word, and then generates a summary.
Look at what repeats as the input grows:
- Primary operation: Looping through each paragraph and then each word inside it.
- How many times: Once for every paragraph, and inside that, once for every word in that paragraph.
The time to process grows with the total number of words in the document.
| Input Size (n = total words) | Approx. Operations |
|---|---|
| 10 | About 10 word checks |
| 100 | About 100 word checks |
| 1000 | About 1000 word checks |
Pattern observation: The time grows roughly in direct proportion to the number of words; doubling words doubles work.
Time Complexity: O(n)
This means the time to complete the task grows linearly with the size of the document's text.
[X] Wrong: "Processing a document with many paragraphs is always slow because of nested loops."
[OK] Correct: The loops are nested, but the total work depends on the total number of words, not just paragraphs. So if paragraphs are short, it may still be fast.
Understanding how processing time grows with input size helps you explain how AI tools like Copilot handle large documents efficiently.
"What if Copilot analyzed only every other word instead of every word? How would the time complexity change?"