1. Description
An offline algorithm is an algorithm that processes all input data at once, making decisions based on the complete dataset before producing any output.
Use an offline algorithm when:
- You’re given the entire input up front and you’re allowed to process it all at once.
- You can reorder, sort, or batch the input to optimize performance.
- You’re solving problems like range queries, event merging, or multiple queries on static data.
- You want to preprocess the input and answer many queries efficiently.