Practice
Solution
Step 1: Analyze the algorithm
The time complexity is determined by the number of data points (n), clusters (k), dimensions (d), and iterations (i).Step 2: Eliminate wrong options
O(n^2) and C are incorrect as they don't account for k, d, and i. O(k^2) is incorrect because it doesn't consider n, d, and i.Final Answer:
Option A -> Option AQuick Check:
Consider n, k, d, and i for complexity. [OK]
Solution
Step 1: Analyze the DCG Calculation
DCG involves iterating over the list once and performing constant-time operations for each element.Step 2: Determine Complexity
Since each element is processed once, the complexity is O(n).Final Answer:
Option A -> Option AQuick Check:
DCG iterates once over n elements. [OK]
Solution
Step 1: Analyze the operations
Calculating precision, recall, and F1-score involves basic arithmetic operations on a fixed-size matrix.Step 2: Determine complexity
These operations are constant time, O(1), as they do not depend on the size of the input data.Final Answer:
Option A -> Option AQuick Check:
Fixed-size matrix operations are O(1). [OK]
Solution
Step 1: Analyze the operation
Train-test split with stratification involves iterating over the dataset once to ensure class distribution.Step 2: Determine complexity
Since each element is processed once, the complexity is O(n).Final Answer:
Option A -> Option AQuick Check:
Stratified split processes each sample once. [OK]
Solution
Step 1: Identify the operations involved
Updating embeddings involves computing gradients and updating weights for the target word and k negative samples.Step 2: Determine the complexity
Each update involves a constant number of operations per sample, leading to O(k) complexity where k is the number of negative samples.Final Answer:
Option A -> Option AQuick Check:
Complexity is O(k) due to k negative samples [OK]
